MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / operator new

Function operator new

extra/yassl/taocrypt/test/memory.cpp:288–304  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

286
287
288void* operator new(size_t sz)
289{
290 // put alloc node in front of requested memory
291 void* ptr = malloc(sz + sizeof(alloc_node));
292 if (ptr) {
293 if (Tracking) {
294 Lock l(mutex);
295 ++Allocs;
296 Bytes += sz;
297 ++sizes[powerOf2(sz)].count_;
298 insert(new (ptr) alloc_node);
299 }
300 return static_cast<char*>(ptr) + sizeof(alloc_node);
301 }
302 else
303 assert(0);
304}
305
306
307void operator delete(void* ptr)

Callers 3

operator new[]Function · 0.70
XMALLOCFunction · 0.70
XREALLOCFunction · 0.70

Calls 2

powerOf2Function · 0.85
insertFunction · 0.85

Tested by

no test coverage detected