memory.c

Include dependency graph for memory.c:

digraph {
    graph [bgcolor="#00000000"]
    node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
    edge [color="#1414CE"]
    "16" [label="stdbool.h" tooltip="stdbool.h"]
    "29" [label="dictionary.h" tooltip="dictionary.h"]
    "17" [label="stdatomic.h" tooltip="stdatomic.h"]
    "7" [label="atom.h" tooltip="atom.h"]
    "32" [label="trace.h" tooltip="trace.h"]
    "11" [label="assert.h" tooltip="assert.h"]
    "18" [label="synclist.h" tooltip="synclist.h"]
    "31" [label="tempstack.h" tooltip="tempstack.h"]
    "6" [label="stdint.h" tooltip="stdint.h"]
    "2" [label="stdlib.h" tooltip="stdlib.h"]
    "4" [label="context.h" tooltip="context.h"]
    "22" [label="utils.h" tooltip="utils.h"]
    "8" [label="atom_table.h" tooltip="atom_table.h"]
    "10" [label="term_typedef.h" tooltip="term_typedef.h"]
    "23" [label="stddef.h" tooltip="stddef.h"]
    "12" [label="limits.h" tooltip="limits.h"]
    "24" [label="refc_binary.h" tooltip="refc_binary.h"]
    "3" [label="string.h" tooltip="string.h"]
    "27" [label="mailbox.h" tooltip="mailbox.h"]
    "20" [label="term.h" tooltip="term.h"]
    "9" [label="erl_nif.h" tooltip="erl_nif.h"]
    "25" [label="resources.h" tooltip="resources.h"]
    "15" [label="smp.h" tooltip="smp.h"]
    "30" [label="erl_nif_priv.h" tooltip="erl_nif_priv.h"]
    "28" [label="debug.h" tooltip="debug.h"]
    "5" [label="globalcontext.h" tooltip="globalcontext.h"]
    "1" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/memory.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/memory.c" fillcolor="#BFBFBF"]
    "21" [label="memory.h" tooltip="memory.h"]
    "19" [label="stdio.h" tooltip="stdio.h"]
    "26" [label="timer_list.h" tooltip="timer_list.h"]
    "14" [label="list.h" tooltip="list.h"]
    "13" [label="inttypes.h" tooltip="inttypes.h"]
    "29" -> "14" [dir=forward tooltip="include"]
    "29" -> "20" [dir=forward tooltip="include"]
    "7" -> "6" [dir=forward tooltip="include"]
    "7" -> "2" [dir=forward tooltip="include"]
    "18" -> "14" [dir=forward tooltip="include"]
    "18" -> "19" [dir=forward tooltip="include"]
    "18" -> "15" [dir=forward tooltip="include"]
    "31" -> "10" [dir=forward tooltip="include"]
    "31" -> "22" [dir=forward tooltip="include"]
    "4" -> "5" [dir=forward tooltip="include"]
    "4" -> "14" [dir=forward tooltip="include"]
    "4" -> "27" [dir=forward tooltip="include"]
    "4" -> "15" [dir=forward tooltip="include"]
    "4" -> "20" [dir=forward tooltip="include"]
    "4" -> "26" [dir=forward tooltip="include"]
    "22" -> "23" [dir=forward tooltip="include"]
    "8" -> "7" [dir=forward tooltip="include"]
    "10" -> "11" [dir=forward tooltip="include"]
    "10" -> "12" [dir=forward tooltip="include"]
    "10" -> "13" [dir=forward tooltip="include"]
    "10" -> "6" [dir=forward tooltip="include"]
    "24" -> "16" [dir=forward tooltip="include"]
    "24" -> "2" [dir=forward tooltip="include"]
    "24" -> "14" [dir=forward tooltip="include"]
    "24" -> "25" [dir=forward tooltip="include"]
    "24" -> "15" [dir=forward tooltip="include"]
    "27" -> "16" [dir=forward tooltip="include"]
    "27" -> "14" [dir=forward tooltip="include"]
    "27" -> "15" [dir=forward tooltip="include"]
    "27" -> "10" [dir=forward tooltip="include"]
    "27" -> "22" [dir=forward tooltip="include"]
    "20" -> "16" [dir=forward tooltip="include"]
    "20" -> "6" [dir=forward tooltip="include"]
    "20" -> "19" [dir=forward tooltip="include"]
    "20" -> "2" [dir=forward tooltip="include"]
    "20" -> "3" [dir=forward tooltip="include"]
    "20" -> "21" [dir=forward tooltip="include"]
    "20" -> "24" [dir=forward tooltip="include"]
    "20" -> "22" [dir=forward tooltip="include"]
    "20" -> "10" [dir=forward tooltip="include"]
    "9" -> "10" [dir=forward tooltip="include"]
    "25" -> "2" [dir=forward tooltip="include"]
    "25" -> "9" [dir=forward tooltip="include"]
    "25" -> "14" [dir=forward tooltip="include"]
    "25" -> "21" [dir=forward tooltip="include"]
    "15" -> "16" [dir=forward tooltip="include"]
    "15" -> "17" [dir=forward tooltip="include"]
    "30" -> "4" [dir=forward tooltip="include"]
    "30" -> "21" [dir=forward tooltip="include"]
    "28" -> "4" [dir=forward tooltip="include"]
    "5" -> "6" [dir=forward tooltip="include"]
    "5" -> "7" [dir=forward tooltip="include"]
    "5" -> "8" [dir=forward tooltip="include"]
    "5" -> "9" [dir=forward tooltip="include"]
    "5" -> "14" [dir=forward tooltip="include"]
    "5" -> "15" [dir=forward tooltip="include"]
    "5" -> "18" [dir=forward tooltip="include"]
    "5" -> "20" [dir=forward tooltip="include"]
    "5" -> "26" [dir=forward tooltip="include"]
    "1" -> "2" [dir=forward tooltip="include"]
    "1" -> "3" [dir=forward tooltip="include"]
    "1" -> "4" [dir=forward tooltip="include"]
    "1" -> "28" [dir=forward tooltip="include"]
    "1" -> "29" [dir=forward tooltip="include"]
    "1" -> "30" [dir=forward tooltip="include"]
    "1" -> "14" [dir=forward tooltip="include"]
    "1" -> "21" [dir=forward tooltip="include"]
    "1" -> "24" [dir=forward tooltip="include"]
    "1" -> "31" [dir=forward tooltip="include"]
    "1" -> "20" [dir=forward tooltip="include"]
    "1" -> "32" [dir=forward tooltip="include"]
    "1" -> "22" [dir=forward tooltip="include"]
    "21" -> "9" [dir=forward tooltip="include"]
    "21" -> "10" [dir=forward tooltip="include"]
    "21" -> "22" [dir=forward tooltip="include"]
    "21" -> "6" [dir=forward tooltip="include"]
    "21" -> "2" [dir=forward tooltip="include"]
    "26" -> "16" [dir=forward tooltip="include"]
    "26" -> "6" [dir=forward tooltip="include"]
    "26" -> "14" [dir=forward tooltip="include"]
}

Defines

MAX(a, b)
FIBONACCI_HEAP_GROWTH_REDUCTION_THRESHOLD

Functions

static void memory_scan_and_copy(HeapFragment *old_fragment, term *mem_start, const term *mem_end, term **new_heap_pos, term *mso_list, bool move)
static term memory_shallow_copy_term(HeapFragment *old_fragment, term t, term **new_heap, bool move)
static enum MemoryGCResult memory_gc(Context *ctx, size_t new_size, size_t num_roots, term *roots)
enum MemoryGCResult memory_init_heap(Heap *heap, size_t size)
void memory_init_heap_root_fragment(Heap *heap, HeapFragment *root, size_t size)
static inline enum MemoryGCResult memory_heap_alloc_new_fragment(Heap *heap, size_t size)
enum MemoryGCResult memory_erl_nif_env_ensure_free(ErlNifEnv *env, size_t size)
static size_t next_fibonacci_heap_size(size_t size)
enum MemoryGCResult memory_ensure_free_with_roots(Context *c, size_t size, size_t num_roots, term *roots, enum MemoryAllocMode alloc_mode)
static inline void push_to_stack(term **stack, term value)
static inline int memory_is_moved_marker(term *t)
static inline void memory_replace_with_moved_marker(term *to_be_replaced, term replace_with)
static inline term memory_dereference_moved_marker(const term *moved_marker)
static term memory_copy_term_tree_internal(term **heap_ptr, term *mso_list, term t)
term memory_copy_term_tree(Heap *new_heap, term t)
term memory_copy_term_tree_to_storage(term *storage, term **heap_end, term t)
unsigned long memory_estimate_usage(term t)
static inline HOT_FUNC bool memory_heap_fragment_contains_pointer (HeapFragment *old_fragment, term *ptr)
void memory_heap_append_fragment(Heap *heap, HeapFragment *fragment, term mso_list)
void memory_sweep_mso_list(term mso_list, GlobalContext *global)