MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / Free

Method Free

Source/Memory/stack_allocator.cpp:67–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65}
66
67void StackAllocator::Free(void* ptr) {
68 current_allocation_count--;
69 // AssertMainThread();
70#ifdef DEBUG_DISABLE_STACK_ALLOCATOR
71 OG_FREE(ptr);
72#else // DEBUG_DISABLE_STACK_ALLOCATOR
73 if (stack_blocks) {
74 --stack_blocks;
75 LOG_ASSERT(ptr == (void*)((uintptr_t)mem + stack_block_pts[stack_blocks]));
76 if (ptr != (void*)((uintptr_t)mem + stack_block_pts[stack_blocks])) {
77 LOGE << "Called fre on something that isn't at the top of the stack" << endl;
78 LOGE << "Stacktrace:" << endl
79 << GenerateStacktrace() << endl;
80 }
81
82 } else {
83#ifndef NO_ERR
84 FatalError("Memory stack underflow", "Calling Free() on StackMemoryBlock with no stack elements");
85#endif
86 }
87#endif // DEBUG_DISABLE_STACK_ALLOCATOR
88}
89
90uintptr_t StackAllocator::TopBlockSize() {
91 switch (stack_blocks) {

Callers 15

~StackMemMethod · 0.45
LoadCubeMapMipmapsHDRMethod · 0.45
LoadMethod · 0.45
DrawMethod · 0.45
StackLoadTextFunction · 0.45
test<5>Method · 0.45
DrawScriptParamsEditorFunction · 0.45
DrawImGuiFunction · 0.45
DisposeMethod · 0.45
ChecksumFunction · 0.45
DeleteMessageMethod · 0.45

Calls 2

GenerateStacktraceFunction · 0.85
FatalErrorFunction · 0.50

Tested by 1

test<5>Method · 0.36