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"]
    "14" [label="stdbool.h" tooltip="stdbool.h"]
    "27" [label="dictionary.h" tooltip="dictionary.h"]
    "15" [label="stdatomic.h" tooltip="stdatomic.h"]
    "7" [label="atom.h" tooltip="atom.h"]
    "30" [label="trace.h" tooltip="trace.h"]
    "16" [label="synclist.h" tooltip="synclist.h"]
    "29" [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"]
    "20" [label="utils.h" tooltip="utils.h"]
    "9" [label="term_typedef.h" tooltip="term_typedef.h"]
    "21" [label="stddef.h" tooltip="stddef.h"]
    "10" [label="limits.h" tooltip="limits.h"]
    "22" [label="refc_binary.h" tooltip="refc_binary.h"]
    "3" [label="string.h" tooltip="string.h"]
    "25" [label="mailbox.h" tooltip="mailbox.h"]
    "18" [label="term.h" tooltip="term.h"]
    "8" [label="erl_nif.h" tooltip="erl_nif.h"]
    "23" [label="resources.h" tooltip="resources.h"]
    "13" [label="smp.h" tooltip="smp.h"]
    "28" [label="erl_nif_priv.h" tooltip="erl_nif_priv.h"]
    "26" [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"]
    "19" [label="memory.h" tooltip="memory.h"]
    "17" [label="stdio.h" tooltip="stdio.h"]
    "24" [label="timer_list.h" tooltip="timer_list.h"]
    "12" [label="list.h" tooltip="list.h"]
    "11" [label="inttypes.h" tooltip="inttypes.h"]
    "27" -> "12" [dir=forward tooltip="include"]
    "27" -> "18" [dir=forward tooltip="include"]
    "7" -> "6" [dir=forward tooltip="include"]
    "7" -> "2" [dir=forward tooltip="include"]
    "16" -> "12" [dir=forward tooltip="include"]
    "16" -> "17" [dir=forward tooltip="include"]
    "16" -> "13" [dir=forward tooltip="include"]
    "29" -> "9" [dir=forward tooltip="include"]
    "29" -> "20" [dir=forward tooltip="include"]
    "4" -> "5" [dir=forward tooltip="include"]
    "4" -> "12" [dir=forward tooltip="include"]
    "4" -> "25" [dir=forward tooltip="include"]
    "4" -> "13" [dir=forward tooltip="include"]
    "4" -> "18" [dir=forward tooltip="include"]
    "4" -> "24" [dir=forward tooltip="include"]
    "20" -> "21" [dir=forward tooltip="include"]
    "9" -> "10" [dir=forward tooltip="include"]
    "9" -> "11" [dir=forward tooltip="include"]
    "9" -> "6" [dir=forward tooltip="include"]
    "22" -> "14" [dir=forward tooltip="include"]
    "22" -> "2" [dir=forward tooltip="include"]
    "22" -> "12" [dir=forward tooltip="include"]
    "22" -> "23" [dir=forward tooltip="include"]
    "22" -> "13" [dir=forward tooltip="include"]
    "25" -> "14" [dir=forward tooltip="include"]
    "25" -> "12" [dir=forward tooltip="include"]
    "25" -> "13" [dir=forward tooltip="include"]
    "25" -> "9" [dir=forward tooltip="include"]
    "25" -> "20" [dir=forward tooltip="include"]
    "18" -> "14" [dir=forward tooltip="include"]
    "18" -> "6" [dir=forward tooltip="include"]
    "18" -> "17" [dir=forward tooltip="include"]
    "18" -> "2" [dir=forward tooltip="include"]
    "18" -> "3" [dir=forward tooltip="include"]
    "18" -> "19" [dir=forward tooltip="include"]
    "18" -> "22" [dir=forward tooltip="include"]
    "18" -> "20" [dir=forward tooltip="include"]
    "18" -> "9" [dir=forward tooltip="include"]
    "8" -> "9" [dir=forward tooltip="include"]
    "23" -> "2" [dir=forward tooltip="include"]
    "23" -> "8" [dir=forward tooltip="include"]
    "23" -> "12" [dir=forward tooltip="include"]
    "13" -> "14" [dir=forward tooltip="include"]
    "13" -> "15" [dir=forward tooltip="include"]
    "28" -> "4" [dir=forward tooltip="include"]
    "28" -> "19" [dir=forward tooltip="include"]
    "26" -> "4" [dir=forward tooltip="include"]
    "5" -> "6" [dir=forward tooltip="include"]
    "5" -> "7" [dir=forward tooltip="include"]
    "5" -> "8" [dir=forward tooltip="include"]
    "5" -> "12" [dir=forward tooltip="include"]
    "5" -> "13" [dir=forward tooltip="include"]
    "5" -> "16" [dir=forward tooltip="include"]
    "5" -> "18" [dir=forward tooltip="include"]
    "5" -> "24" [dir=forward tooltip="include"]
    "1" -> "2" [dir=forward tooltip="include"]
    "1" -> "3" [dir=forward tooltip="include"]
    "1" -> "4" [dir=forward tooltip="include"]
    "1" -> "26" [dir=forward tooltip="include"]
    "1" -> "27" [dir=forward tooltip="include"]
    "1" -> "28" [dir=forward tooltip="include"]
    "1" -> "12" [dir=forward tooltip="include"]
    "1" -> "19" [dir=forward tooltip="include"]
    "1" -> "22" [dir=forward tooltip="include"]
    "1" -> "29" [dir=forward tooltip="include"]
    "1" -> "18" [dir=forward tooltip="include"]
    "1" -> "30" [dir=forward tooltip="include"]
    "1" -> "20" [dir=forward tooltip="include"]
    "19" -> "8" [dir=forward tooltip="include"]
    "19" -> "9" [dir=forward tooltip="include"]
    "19" -> "20" [dir=forward tooltip="include"]
    "19" -> "6" [dir=forward tooltip="include"]
    "19" -> "2" [dir=forward tooltip="include"]
    "24" -> "14" [dir=forward tooltip="include"]
    "24" -> "6" [dir=forward tooltip="include"]
    "24" -> "12" [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)