MCPcopy Create free account
hub / github.com/AutoHotkey/AutoHotkey / Delete

Method Delete

source/SimpleHeap.cpp:114–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

112
113
114void SimpleHeap::Delete(void *aPtr)
115// If aPtr is the most recently allocated area of memory by SimpleHeap, this will reclaim that
116// memory. Otherwise, the caller should realize that the memory cannot be reclaimed (i.e. potential
117// memory leak unless caller handles things right).
118{
119 if (aPtr != sMostRecentlyAllocated || !sMostRecentlyAllocated)
120 return;
121 size_t sMostRecentlyAllocated_size = sLast->mFreeMarker - sMostRecentlyAllocated;
122 sLast->mFreeMarker -= sMostRecentlyAllocated_size;
123 sLast->mSpaceAvailable += sMostRecentlyAllocated_size;
124 sMostRecentlyAllocated = NULL; // i.e. no support for anything other than a one-time delete of an item just added.
125}
126
127
128

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected