memory.h

Include dependency graph for memory.h:

digraph {
    graph [bgcolor="#00000000"]
    node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
    edge [color="#1414CE"]
    "6" [label="assert.h" tooltip="assert.h"]
    "9" [label="utils.h" tooltip="utils.h"]
    "2" [label="stdint.h" tooltip="stdint.h"]
    "3" [label="stdlib.h" tooltip="stdlib.h"]
    "1" [label="/__w/AtomVM/AtomVM/src/libAtomVM/memory.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/memory.h" fillcolor="#BFBFBF"]
    "10" [label="stddef.h" tooltip="stddef.h"]
    "4" [label="erl_nif.h" tooltip="erl_nif.h"]
    "7" [label="limits.h" tooltip="limits.h"]
    "5" [label="term_typedef.h" tooltip="term_typedef.h"]
    "11" [label="stdio.h" tooltip="stdio.h"]
    "8" [label="inttypes.h" tooltip="inttypes.h"]
    "9" -> "10" [dir=forward tooltip="include"]
    "9" -> "11" [dir=forward tooltip="include"]
    "9" -> "3" [dir=forward tooltip="include"]
    "1" -> "2" [dir=forward tooltip="include"]
    "1" -> "3" [dir=forward tooltip="include"]
    "1" -> "4" [dir=forward tooltip="include"]
    "1" -> "5" [dir=forward tooltip="include"]
    "1" -> "9" [dir=forward tooltip="include"]
    "4" -> "5" [dir=forward tooltip="include"]
    "5" -> "6" [dir=forward tooltip="include"]
    "5" -> "7" [dir=forward tooltip="include"]
    "5" -> "8" [dir=forward tooltip="include"]
    "5" -> "2" [dir=forward tooltip="include"]
}

This graph shows which files directly or indirectly include memory.h:

digraph {
    graph [bgcolor="#00000000"]
    node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
    edge [color="#1414CE"]
    "26" [label="/__w/AtomVM/AtomVM/src/libAtomVM/interop.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/interop.c"]
    "9" [label="/__w/AtomVM/AtomVM/src/libAtomVM/refc_binary.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/refc_binary.c"]
    "32" [label="/__w/AtomVM/AtomVM/src/libAtomVM/interop.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/interop.h"]
    "2" [label="/__w/AtomVM/AtomVM/src/libAtomVM/erl_nif_priv.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/erl_nif_priv.h"]
    "16" [label="/__w/AtomVM/AtomVM/src/libAtomVM/nifs.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/nifs.c"]
    "20" [label="/__w/AtomVM/AtomVM/src/libAtomVM/refc_binary.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/refc_binary.h"]
    "40" [label="/__w/AtomVM/AtomVM/src/libAtomVM/nifs.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/nifs.h"]
    "54" [label="/__w/AtomVM/AtomVM/src/libAtomVM/defaultatoms.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/defaultatoms.h"]
    "48" [label="/__w/AtomVM/AtomVM/src/libAtomVM/dictionary.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/dictionary.c"]
    "49" [label="/__w/AtomVM/AtomVM/src/libAtomVM/dictionary.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/dictionary.h"]
    "3" [label="/__w/AtomVM/AtomVM/src/libAtomVM/context.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/context.c"]
    "22" [label="/__w/AtomVM/AtomVM/src/libAtomVM/bif.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/bif.c"]
    "27" [label="/__w/AtomVM/AtomVM/src/libAtomVM/context.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/context.h"]
    "28" [label="/__w/AtomVM/AtomVM/src/libAtomVM/bif.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/bif.h"]
    "56" [label="/__w/AtomVM/AtomVM/src/libAtomVM/ets_hashtable.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/ets_hashtable.c"]
    "33" [label="/__w/AtomVM/AtomVM/src/libAtomVM/otp_crypto.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/otp_crypto.c"]
    "55" [label="/__w/AtomVM/AtomVM/src/libAtomVM/ets_hashtable.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/ets_hashtable.h"]
    "46" [label="/__w/AtomVM/AtomVM/src/libAtomVM/portnifloader.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/portnifloader.c"]
    "41" [label="/__w/AtomVM/AtomVM/src/libAtomVM/otp_crypto.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/otp_crypto.h"]
    "5" [label="/__w/AtomVM/AtomVM/src/libAtomVM/memory.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/memory.c"]
    "45" [label="/__w/AtomVM/AtomVM/src/libAtomVM/portnifloader.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/portnifloader.h"]
    "1" [label="/__w/AtomVM/AtomVM/src/libAtomVM/memory.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/memory.h" fillcolor="#BFBFBF"]
    "39" [label="/__w/AtomVM/AtomVM/src/libAtomVM/sys.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/sys.h"]
    "29" [label="/__w/AtomVM/AtomVM/src/libAtomVM/module.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/module.c"]
    "35" [label="/__w/AtomVM/AtomVM/src/libAtomVM/module.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/module.h"]
    "14" [label="/__w/AtomVM/AtomVM/src/libAtomVM/otp_net.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/otp_net.c"]
    "42" [label="/__w/AtomVM/AtomVM/src/libAtomVM/otp_net.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/otp_net.h"]
    "10" [label="/__w/AtomVM/AtomVM/src/libAtomVM/resources.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/resources.c"]
    "19" [label="/__w/AtomVM/AtomVM/src/libAtomVM/resources.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/resources.h"]
    "13" [label="/__w/AtomVM/AtomVM/src/libAtomVM/inet.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/inet.c"]
    "34" [label="/__w/AtomVM/AtomVM/src/libAtomVM/term.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/term.c"]
    "12" [label="/__w/AtomVM/AtomVM/src/libAtomVM/inet.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/inet.h"]
    "21" [label="/__w/AtomVM/AtomVM/src/libAtomVM/term.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/term.h"]
    "58" [label="/__w/AtomVM/AtomVM/src/libAtomVM/exportedfunction.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/exportedfunction.h"]
    "31" [label="/__w/AtomVM/AtomVM/src/libAtomVM/debug.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/debug.c"]
    "30" [label="/__w/AtomVM/AtomVM/src/libAtomVM/debug.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/debug.h"]
    "25" [label="/__w/AtomVM/AtomVM/src/libAtomVM/externalterm.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/externalterm.c"]
    "59" [label="/__w/AtomVM/AtomVM/src/libAtomVM/externalterm.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/externalterm.h"]
    "53" [label="/__w/AtomVM/AtomVM/src/libAtomVM/avmpack.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/avmpack.c"]
    "52" [label="/__w/AtomVM/AtomVM/src/libAtomVM/avmpack.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/avmpack.h"]
    "4" [label="/__w/AtomVM/AtomVM/src/libAtomVM/globalcontext.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/globalcontext.c"]
    "51" [label="/__w/AtomVM/AtomVM/src/libAtomVM/globalcontext.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/globalcontext.h"]
    "36" [label="/__w/AtomVM/AtomVM/src/libAtomVM/platform_nifs.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/platform_nifs.h"]
    "24" [label="/__w/AtomVM/AtomVM/src/libAtomVM/bitstring.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/bitstring.c"]
    "23" [label="/__w/AtomVM/AtomVM/src/libAtomVM/bitstring.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/bitstring.h"]
    "60" [label="/__w/AtomVM/AtomVM/src/libAtomVM/overflow_helpers.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/overflow_helpers.h"]
    "47" [label="/__w/AtomVM/AtomVM/src/libAtomVM/scheduler.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/scheduler.h"]
    "6" [label="/__w/AtomVM/AtomVM/src/libAtomVM/otp_socket.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/otp_socket.c"]
    "43" [label="/__w/AtomVM/AtomVM/src/libAtomVM/otp_socket.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/otp_socket.h"]
    "38" [label="/__w/AtomVM/AtomVM/src/libAtomVM/stacktrace.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/stacktrace.c"]
    "37" [label="/__w/AtomVM/AtomVM/src/libAtomVM/stacktrace.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/stacktrace.h"]
    "7" [label="/__w/AtomVM/AtomVM/src/libAtomVM/otp_ssl.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/otp_ssl.c"]
    "44" [label="/__w/AtomVM/AtomVM/src/libAtomVM/otp_ssl.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/otp_ssl.h"]
    "8" [label="/__w/AtomVM/AtomVM/src/libAtomVM/posix_nifs.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/posix_nifs.c"]
    "57" [label="/__w/AtomVM/AtomVM/src/libAtomVM/posix_nifs.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/posix_nifs.h"]
    "15" [label="/__w/AtomVM/AtomVM/src/libAtomVM/mailbox.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/mailbox.c"]
    "18" [label="/__w/AtomVM/AtomVM/src/libAtomVM/port.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/port.c"]
    "17" [label="/__w/AtomVM/AtomVM/src/libAtomVM/port.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/port.h"]
    "11" [label="/__w/AtomVM/AtomVM/src/libAtomVM/ets.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/ets.c"]
    "50" [label="/__w/AtomVM/AtomVM/src/libAtomVM/ets.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/ets.h"]
    "32" -> "12" [dir=back tooltip="include"]
    "32" -> "26" [dir=back tooltip="include"]
    "32" -> "16" [dir=back tooltip="include"]
    "32" -> "33" [dir=back tooltip="include"]
    "32" -> "14" [dir=back tooltip="include"]
    "32" -> "6" [dir=back tooltip="include"]
    "32" -> "7" [dir=back tooltip="include"]
    "32" -> "8" [dir=back tooltip="include"]
    "32" -> "34" [dir=back tooltip="include"]
    "2" -> "3" [dir=back tooltip="include"]
    "2" -> "4" [dir=back tooltip="include"]
    "2" -> "5" [dir=back tooltip="include"]
    "2" -> "6" [dir=back tooltip="include"]
    "2" -> "7" [dir=back tooltip="include"]
    "2" -> "8" [dir=back tooltip="include"]
    "2" -> "9" [dir=back tooltip="include"]
    "2" -> "10" [dir=back tooltip="include"]
    "20" -> "4" [dir=back tooltip="include"]
    "20" -> "5" [dir=back tooltip="include"]
    "20" -> "7" [dir=back tooltip="include"]
    "20" -> "9" [dir=back tooltip="include"]
    "20" -> "10" [dir=back tooltip="include"]
    "20" -> "21" [dir=back tooltip="include"]
    "40" -> "29" [dir=back tooltip="include"]
    "40" -> "16" [dir=back tooltip="include"]
    "40" -> "33" [dir=back tooltip="include"]
    "40" -> "41" [dir=back tooltip="include"]
    "40" -> "14" [dir=back tooltip="include"]
    "40" -> "42" [dir=back tooltip="include"]
    "40" -> "6" [dir=back tooltip="include"]
    "40" -> "43" [dir=back tooltip="include"]
    "40" -> "7" [dir=back tooltip="include"]
    "40" -> "44" [dir=back tooltip="include"]
    "40" -> "45" [dir=back tooltip="include"]
    "40" -> "8" [dir=back tooltip="include"]
    "54" -> "22" [dir=back tooltip="include"]
    "54" -> "48" [dir=back tooltip="include"]
    "54" -> "11" [dir=back tooltip="include"]
    "54" -> "4" [dir=back tooltip="include"]
    "54" -> "26" [dir=back tooltip="include"]
    "54" -> "16" [dir=back tooltip="include"]
    "54" -> "33" [dir=back tooltip="include"]
    "54" -> "14" [dir=back tooltip="include"]
    "54" -> "6" [dir=back tooltip="include"]
    "54" -> "7" [dir=back tooltip="include"]
    "54" -> "18" [dir=back tooltip="include"]
    "54" -> "17" [dir=back tooltip="include"]
    "54" -> "8" [dir=back tooltip="include"]
    "54" -> "10" [dir=back tooltip="include"]
    "54" -> "38" [dir=back tooltip="include"]
    "49" -> "22" [dir=back tooltip="include"]
    "49" -> "3" [dir=back tooltip="include"]
    "49" -> "48" [dir=back tooltip="include"]
    "49" -> "5" [dir=back tooltip="include"]
    "49" -> "16" [dir=back tooltip="include"]
    "49" -> "6" [dir=back tooltip="include"]
    "49" -> "9" [dir=back tooltip="include"]
    "27" -> "28" [dir=back tooltip="include"]
    "27" -> "3" [dir=back tooltip="include"]
    "27" -> "30" [dir=back tooltip="include"]
    "27" -> "2" [dir=back tooltip="include"]
    "27" -> "11" [dir=back tooltip="include"]
    "27" -> "25" [dir=back tooltip="include"]
    "27" -> "4" [dir=back tooltip="include"]
    "27" -> "32" [dir=back tooltip="include"]
    "27" -> "5" [dir=back tooltip="include"]
    "27" -> "29" [dir=back tooltip="include"]
    "27" -> "35" [dir=back tooltip="include"]
    "27" -> "16" [dir=back tooltip="include"]
    "27" -> "40" [dir=back tooltip="include"]
    "27" -> "33" [dir=back tooltip="include"]
    "27" -> "14" [dir=back tooltip="include"]
    "27" -> "6" [dir=back tooltip="include"]
    "27" -> "7" [dir=back tooltip="include"]
    "27" -> "18" [dir=back tooltip="include"]
    "27" -> "17" [dir=back tooltip="include"]
    "27" -> "45" [dir=back tooltip="include"]
    "27" -> "9" [dir=back tooltip="include"]
    "27" -> "10" [dir=back tooltip="include"]
    "27" -> "47" [dir=back tooltip="include"]
    "27" -> "37" [dir=back tooltip="include"]
    "27" -> "34" [dir=back tooltip="include"]
    "28" -> "22" [dir=back tooltip="include"]
    "28" -> "29" [dir=back tooltip="include"]
    "28" -> "16" [dir=back tooltip="include"]
    "55" -> "11" [dir=back tooltip="include"]
    "55" -> "56" [dir=back tooltip="include"]
    "41" -> "33" [dir=back tooltip="include"]
    "45" -> "46" [dir=back tooltip="include"]
    "1" -> "2" [dir=back tooltip="include"]
    "1" -> "11" [dir=back tooltip="include"]
    "1" -> "12" [dir=back tooltip="include"]
    "1" -> "15" [dir=back tooltip="include"]
    "1" -> "5" [dir=back tooltip="include"]
    "1" -> "16" [dir=back tooltip="include"]
    "1" -> "6" [dir=back tooltip="include"]
    "1" -> "17" [dir=back tooltip="include"]
    "1" -> "9" [dir=back tooltip="include"]
    "1" -> "19" [dir=back tooltip="include"]
    "1" -> "38" [dir=back tooltip="include"]
    "1" -> "21" [dir=back tooltip="include"]
    "39" -> "3" [dir=back tooltip="include"]
    "39" -> "4" [dir=back tooltip="include"]
    "39" -> "29" [dir=back tooltip="include"]
    "39" -> "16" [dir=back tooltip="include"]
    "39" -> "6" [dir=back tooltip="include"]
    "39" -> "10" [dir=back tooltip="include"]
    "35" -> "28" [dir=back tooltip="include"]
    "35" -> "29" [dir=back tooltip="include"]
    "35" -> "16" [dir=back tooltip="include"]
    "35" -> "36" [dir=back tooltip="include"]
    "35" -> "37" [dir=back tooltip="include"]
    "35" -> "39" [dir=back tooltip="include"]
    "35" -> "34" [dir=back tooltip="include"]
    "42" -> "14" [dir=back tooltip="include"]
    "19" -> "4" [dir=back tooltip="include"]
    "19" -> "20" [dir=back tooltip="include"]
    "19" -> "10" [dir=back tooltip="include"]
    "12" -> "13" [dir=back tooltip="include"]
    "12" -> "14" [dir=back tooltip="include"]
    "12" -> "6" [dir=back tooltip="include"]
    "12" -> "7" [dir=back tooltip="include"]
    "21" -> "22" [dir=back tooltip="include"]
    "21" -> "23" [dir=back tooltip="include"]
    "21" -> "3" [dir=back tooltip="include"]
    "21" -> "27" [dir=back tooltip="include"]
    "21" -> "48" [dir=back tooltip="include"]
    "21" -> "49" [dir=back tooltip="include"]
    "21" -> "11" [dir=back tooltip="include"]
    "21" -> "50" [dir=back tooltip="include"]
    "21" -> "56" [dir=back tooltip="include"]
    "21" -> "55" [dir=back tooltip="include"]
    "21" -> "58" [dir=back tooltip="include"]
    "21" -> "59" [dir=back tooltip="include"]
    "21" -> "51" [dir=back tooltip="include"]
    "21" -> "13" [dir=back tooltip="include"]
    "21" -> "26" [dir=back tooltip="include"]
    "21" -> "32" [dir=back tooltip="include"]
    "21" -> "5" [dir=back tooltip="include"]
    "21" -> "29" [dir=back tooltip="include"]
    "21" -> "35" [dir=back tooltip="include"]
    "21" -> "16" [dir=back tooltip="include"]
    "21" -> "33" [dir=back tooltip="include"]
    "21" -> "14" [dir=back tooltip="include"]
    "21" -> "6" [dir=back tooltip="include"]
    "21" -> "7" [dir=back tooltip="include"]
    "21" -> "60" [dir=back tooltip="include"]
    "21" -> "17" [dir=back tooltip="include"]
    "21" -> "57" [dir=back tooltip="include"]
    "21" -> "37" [dir=back tooltip="include"]
    "21" -> "34" [dir=back tooltip="include"]
    "58" -> "28" [dir=back tooltip="include"]
    "58" -> "35" [dir=back tooltip="include"]
    "58" -> "40" [dir=back tooltip="include"]
    "58" -> "36" [dir=back tooltip="include"]
    "58" -> "57" [dir=back tooltip="include"]
    "30" -> "31" [dir=back tooltip="include"]
    "30" -> "5" [dir=back tooltip="include"]
    "59" -> "25" [dir=back tooltip="include"]
    "59" -> "29" [dir=back tooltip="include"]
    "59" -> "16" [dir=back tooltip="include"]
    "52" -> "53" [dir=back tooltip="include"]
    "52" -> "4" [dir=back tooltip="include"]
    "52" -> "16" [dir=back tooltip="include"]
    "51" -> "52" [dir=back tooltip="include"]
    "51" -> "3" [dir=back tooltip="include"]
    "51" -> "27" [dir=back tooltip="include"]
    "51" -> "54" [dir=back tooltip="include"]
    "51" -> "55" [dir=back tooltip="include"]
    "51" -> "4" [dir=back tooltip="include"]
    "51" -> "5" [dir=back tooltip="include"]
    "51" -> "29" [dir=back tooltip="include"]
    "51" -> "35" [dir=back tooltip="include"]
    "51" -> "16" [dir=back tooltip="include"]
    "51" -> "33" [dir=back tooltip="include"]
    "51" -> "14" [dir=back tooltip="include"]
    "51" -> "42" [dir=back tooltip="include"]
    "51" -> "6" [dir=back tooltip="include"]
    "51" -> "43" [dir=back tooltip="include"]
    "51" -> "7" [dir=back tooltip="include"]
    "51" -> "44" [dir=back tooltip="include"]
    "51" -> "18" [dir=back tooltip="include"]
    "51" -> "17" [dir=back tooltip="include"]
    "51" -> "45" [dir=back tooltip="include"]
    "51" -> "8" [dir=back tooltip="include"]
    "51" -> "57" [dir=back tooltip="include"]
    "51" -> "47" [dir=back tooltip="include"]
    "51" -> "38" [dir=back tooltip="include"]
    "51" -> "39" [dir=back tooltip="include"]
    "36" -> "16" [dir=back tooltip="include"]
    "23" -> "24" [dir=back tooltip="include"]
    "23" -> "25" [dir=back tooltip="include"]
    "23" -> "26" [dir=back tooltip="include"]
    "23" -> "16" [dir=back tooltip="include"]
    "60" -> "22" [dir=back tooltip="include"]
    "47" -> "4" [dir=back tooltip="include"]
    "47" -> "15" [dir=back tooltip="include"]
    "47" -> "16" [dir=back tooltip="include"]
    "47" -> "6" [dir=back tooltip="include"]
    "43" -> "6" [dir=back tooltip="include"]
    "43" -> "7" [dir=back tooltip="include"]
    "37" -> "38" [dir=back tooltip="include"]
    "44" -> "7" [dir=back tooltip="include"]
    "57" -> "4" [dir=back tooltip="include"]
    "57" -> "16" [dir=back tooltip="include"]
    "57" -> "6" [dir=back tooltip="include"]
    "57" -> "8" [dir=back tooltip="include"]
    "17" -> "13" [dir=back tooltip="include"]
    "17" -> "16" [dir=back tooltip="include"]
    "17" -> "14" [dir=back tooltip="include"]
    "17" -> "6" [dir=back tooltip="include"]
    "17" -> "7" [dir=back tooltip="include"]
    "17" -> "18" [dir=back tooltip="include"]
    "50" -> "11" [dir=back tooltip="include"]
    "50" -> "51" [dir=back tooltip="include"]
    "50" -> "16" [dir=back tooltip="include"]
}

Defines

HEAP_NEED_GC_SHRINK_THRESHOLD_COEFF 64
MIN_FREE_SPACE_SIZE 16
TYPEDEF_CONTEXT
TYPEDEF_GLOBALCONTEXT
TYPEDEF_HEAP
BEGIN_WITH_STACK_HEAP(size, name)

struct                                \

{                                     \

HeapFragment

*next;               \

union                             \

{                                 \

term mso_list;                \             term

*heap_end;               \

};                                \

term

storage[size];               \

} name##__root__;                     \

Heap name;                            \     memory_init_heap_root_fragment(&name, (HeapFragment *) &(name##__root__), size);
END_WITH_STACK_HEAP(name, global) memory_sweep_mso_list

(name.root->mso_list, global, true); \

if (name.root->next) {                                    \

memory_destroy_heap_fragment

(name.root->next);        \

}


STORAGE_MSO_LIST_INDEX 0
STORAGE_HEAP_START_INDEX 1

Typedefs

typedef struct Context Context
typedef struct GlobalContext GlobalContext
typedef struct HeapFragment HeapFragment
typedef struct Heap Heap

Enums

enum MemoryGCResult

Values:

enumerator MEMORY_GC_OK = 0
enumerator MEMORY_GC_ERROR_FAILED_ALLOCATION = 1
enumerator MEMORY_GC_DENIED_ALLOCATION = 2
enum MemoryAllocMode

Values:

enumerator MEMORY_NO_SHRINK = 0
enumerator MEMORY_CAN_SHRINK = 1
enumerator MEMORY_FORCE_SHRINK = 2
enumerator MEMORY_NO_GC = 3

Functions

void memory_init_heap_root_fragment(Heap *heap, HeapFragment *root, size_t size)

Setup heap from its root. Set the mso_list to NIL and initialize heap_ptr.

Parameters:
  • heap – heap to initialize.

  • root – fragment root.

  • size – capacity of the heap to create, not including the mso_list.

enum MemoryGCResult memory_init_heap(Heap *heap, size_t size)

Initialize a root heap.

This function should be balanced with memory_destroy_heap or memory_destroy_heap_from_task if the heap is created by a driver task.

Parameters:
  • heap – heap to initialize.

  • size – capacity of the heap to create, not including the mso_list.

Returns:

MEMORY_GC_OK or MEMORY_GC_ERROR_FAILED_ALLOCATION depending on the outcome.

static inline size_t memory_heap_fragment_memory_size(const HeapFragment *fragment)

return the total memory size of a heap fragment and its children.

Parameters:
  • fragment – the root fragment to get the size of

Returns:

the size in terms

static inline size_t memory_heap_youngest_size(const Heap *heap)

return the size of the youngest generation of the heap.

in some condition, this function returns the size of a fragment where the stack is not.

Parameters:
  • heap – the heap to get the youngest size of

Returns:

the size in terms

static inline size_t memory_heap_memory_size(const Heap *heap)

return the total memory size of a heap, including fragments.

Parameters:
  • heap – the heap to get the size of

Returns:

the size in terms

static inline term *memory_heap_alloc(Heap *heap, size_t size)

allocates space for a certain amount of terms on the heap

allocates space for a certain amount of terms on the heap, GC will be performed when needed, any existing term might be invalid after this call.

Parameters:
  • heap – heap to initialize.

  • size – the amount of terms that will be allocated.

Returns:

a pointer to the newly allocated memory block.

static inline void memory_heap_trim(Heap *heap, size_t size)

shrinks the heap by size units

this function is used when resizing the last item allocated on the heap.

Parameters:
  • heap – the heap that will be shrinked

  • size – the number of terms that will be removed

term memory_copy_term_tree(Heap *new_heap, term t)

copies a term to a destination heap

deep copies a term to a destination heap, once finished old memory can be freed.

Parameters:
  • new_heap – the destination heap where terms will be copied.

  • t – term to copy

Returns:

a new term that is stored on the new heap.

enum MemoryGCResult memory_ensure_free_with_roots(Context *ctx, size_t size, size_t num_roots, term *roots, enum MemoryAllocMode alloc_mode)

makes sure that the given context has given free memory.

this function makes sure at least size terms are available. Optionally, it can allocate a fragment or shrink the heap to the specified size, depending on allocation strategy. The function can also be passed roots to update during any garbage collection.

Parameters:
  • ctx – the target context.

  • size – needed available memory.

  • num_roots – number of roots

  • roots – roots to preserve

  • alloc_mode – constraint on allocation of additional memory

static inline enum MemoryGCResult memory_ensure_free_opt(Context *ctx, size_t size, enum MemoryAllocMode alloc_mode)

makes sure that the given context has given free memory.

this function makes sure at least size terms are available. Optionally, it can shrink the heap to the specified size, depending on allocation strategy.

Parameters:
  • ctx – the target context.

  • size – needed available memory.

  • alloc_mode – constraint on allocation of additional memory

static inline enum MemoryGCResult memory_ensure_free(Context *ctx, size_t size)

makes sure that the given context has given free memory

this function makes sure that at least size terms are available, when not available gc will be performed, any existing term might be invalid after this call. It does not shrink the heap, so if this function is called with a given value N and it is later called with a smaller value n, the actual amount of available free memory is N.

Parameters:
  • ctx – the target context.

  • size – needed available memory.

enum MemoryGCResult memory_erl_nif_env_ensure_free(ErlNifEnv *env, size_t size)

makes sure that the given nif environment has given free memory

this function makes sure that at least size terms are available. When not available, a new fragment will be allocated.

Parameters:
  • env – the target environment.

  • size – needed available memory.

term memory_copy_term_tree_to_storage(term *storage, term **heap_end, term t)

copies a term to a storage, typically for mailbox messages

deep copies a term to a destination heap, once finished old memory can be freed.

Parameters:
  • storage – storage for the copied data, should be large enough

  • heap_end – on output, pointer to the end of the term.

  • t – term to copy

Returns:

a boxed term pointer to the new term content that is stored in the storage.

unsigned long memory_estimate_usage(term t)

calculates term memory usage

perform an used memory calculation using given term as root, shared memory (that is not part of the memory block) is not accounted.

Parameters:
  • t – root term on which used memory calculation will be performed.

Returns:

used memory terms count in term units output parameter.

void memory_heap_append_fragment(Heap *heap, HeapFragment *fragment, term mso_list)

append a fragment to a heap. The MSO list is merged. The fragment will then be owned by the heap.

Parameters:
  • heap – the heap to append the fragment to

  • fragment – the fragment to add

  • mso_list – associated mso list or nil

static inline void memory_heap_append_heap(Heap *target, Heap *source)

append a heap to another heap. The MSO list is merged. The fragments of the source heap will be owned by the target heap.

Parameters:
  • target – the heap to append the heap’s fragments to

  • source – the heap to add

void memory_sweep_mso_list(term mso_list, GlobalContext *global, bool from_task)

Sweep any unreferenced binaries in the “Mark Sweep Object” (MSO) list.

The MSO list is a list of term (references) in a heap. Currently, the elements of this list are referenced to reference-counted binaries or match binaries that themselves reference reference counted binaries. This function will iterate over the binaries in this list, and decrement the reference count of any elements that have not been marked for move (e.g., into a new heap). If the reference count reaches 0, then memory associated with the referenced binary will be freed.In a typical GC event, the terms in this list are within in the old heap or potentially in a heap fragment. However, this function may be called in a copy even, such as in a process spawn, or in the copy of a term to or from a process mailbox.

Parameters:
  • mso_list – the list of mark-sweep object in a heap “space”

  • global – the global context

  • from_task – boolean, true if called from a task, false otherwise

static inline void memory_destroy_heap_fragment(HeapFragment *fragment)

Destroy a chain of heap fragments.

Parameters:
  • fragment – fragment to destroy.

static inline void memory_destroy_heap(Heap *heap, GlobalContext *global)

Destroy a root heap. First sweep its mso list.

This function shall only be called from a scheduler thread (native handler or listener) because it decrements the reference count of refc binaries and may call resource destructors.

Parameters:
  • heap – the heap to destroy

  • global – the global context

static inline void memory_destroy_heap_from_task(Heap *heap, GlobalContext *global)

Destroy a root heap. First sweep its mso list.

This variant is safer and is meant for driver tasks.

Parameters:
  • heap – the heap to destroy

  • global – the global context

struct HeapFragment
#include <memory.h>

Collaboration diagram for HeapFragment:

digraph {
    graph [bgcolor="#00000000"]
    node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
    edge [color="#1414CE"]
    "1" [label="HeapFragment" tooltip="HeapFragment" fillcolor="#BFBFBF"]
    "1" -> "1" [dir=forward tooltip="usage"]
}

Public Members

HeapFragment *next
term mso_list
term *heap_end
union HeapFragment.[anonymous] [anonymous]
term storage[]
struct Heap
#include <memory.h>

Collaboration diagram for Heap:

digraph {
    graph [bgcolor="#00000000"]
    node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
    edge [color="#1414CE"]
    "2" [label="HeapFragment" tooltip="HeapFragment"]
    "1" [label="Heap" tooltip="Heap" fillcolor="#BFBFBF"]
    "2" -> "2" [dir=forward tooltip="usage"]
    "1" -> "2" [dir=forward tooltip="usage"]
}

Public Members

HeapFragment *root
term *heap_start
term *heap_ptr
term *heap_end