MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / _memory_deallocate_defer

Function _memory_deallocate_defer

vm/ByteCodeTranslator/src/rpmalloc.c:1118–1127  ·  view source on GitHub ↗

Defer deallocation of the given block to the given heap

Source from the content-addressed store, hash-verified

1116
1117//! Defer deallocation of the given block to the given heap
1118static void
1119_memory_deallocate_defer(int32_t heap_id, void* p) {
1120 //Get the heap and link in pointer in list of deferred opeations
1121 heap_t* heap = _memory_heap_lookup(heap_id);
1122 void* last_ptr;
1123 do {
1124 last_ptr = atomic_load_ptr(&heap->defer_deallocate);
1125 *(void**)p = last_ptr; //Safe to use block, it's being deallocated
1126 } while (!atomic_cas_ptr(&heap->defer_deallocate, p, last_ptr));
1127}
1128
1129//! Allocate a block of the given size
1130static void*

Callers 1

_memory_deallocateFunction · 0.85

Calls 3

_memory_heap_lookupFunction · 0.85
atomic_load_ptrFunction · 0.85
atomic_cas_ptrFunction · 0.85

Tested by

no test coverage detected