MCPcopy Create free account
hub / github.com/beefytech/Beef / StompAlloc

Function StompAlloc

BeefySysLib/util/AllocDebug.cpp:195–225  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

193}
194
195void* StompAlloc(int size)
196{
197 //return malloc(size);
198
199 if (gStompInside)
200 return malloc(size);
201 if (gSA_CritSect == NULL)
202 StompInit();
203
204 AutoCrit autoCrit(*gSA_CritSect);
205 if (gStompInside)
206 return malloc(size);
207 gStompInside = true;
208
209 while (true)
210 {
211 for (auto itr = gAllocRanges->rbegin(); itr != gAllocRanges->rend(); itr++)
212 {
213 auto& alloc = *itr;
214 void* result = alloc.Alloc(size);
215 if (result != NULL)
216 {
217 gStompInside = false;
218 return result;
219 }
220 }
221
222 gAllocRanges->resize(gAllocRanges->size() + 1);
223 }
224 gStompInside = false;
225}
226
227void StompFree(void* addr)
228{

Callers 5

GrowPoolMethod · 0.70
AllocBytesMethod · 0.70
allocateMethod · 0.70
rawAllocateMethod · 0.70
operator newFunction · 0.70

Calls 5

StompInitFunction · 0.85
mallocFunction · 0.50
AllocMethod · 0.45
resizeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected