Home / Function/ malloc() — netty Function Reference

malloc() — netty Function Reference

Architecture documentation for the malloc() function in CleanerJava24Linker.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  add871eb_c3ef_e875_fa27_a4789f284655["malloc()"]
  0c08734e_1658_4777_76f5_6b6460f4d613["CleanerJava24Linker"]
  add871eb_c3ef_e875_fa27_a4789f284655 -->|defined in| 0c08734e_1658_4777_76f5_6b6460f4d613
  0ef8ae96_0679_0b3e_6dd3_5e3f708bc569["CleanableDirectBufferImpl()"]
  0ef8ae96_0679_0b3e_6dd3_5e3f708bc569 -->|calls| add871eb_c3ef_e875_fa27_a4789f284655
  style add871eb_c3ef_e875_fa27_a4789f284655 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

common/src/main/java/io/netty/util/internal/CleanerJava24Linker.java lines 206–219

    static long malloc(int capacity) {
        final long addr;
        try {
            // Always allocate at least 1 byte, to avoid relying on non-portable behavior
            // of malloc(3) for zero size allocations.
            addr = (long) INVOKE_MALLOC.invokeExact(Math.max(capacity, 1L));
        } catch (Throwable e) {
            throw new Error(e); // Should not happen.
        }
        if (addr == 0) {
            throw new OutOfMemoryError("malloc(2) failed to allocate " + capacity + " bytes");
        }
        return addr;
    }

Domain

Subdomains

Frequently Asked Questions

What does malloc() do?
malloc() is a function in the netty codebase, defined in common/src/main/java/io/netty/util/internal/CleanerJava24Linker.java.
Where is malloc() defined?
malloc() is defined in common/src/main/java/io/netty/util/internal/CleanerJava24Linker.java at line 206.
What calls malloc()?
malloc() is called by 1 function(s): CleanableDirectBufferImpl.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free