void* operator new[] (size_t size) { void *p; leaktracer::MemoryTrace::Setup(); p = LT_MALLOC(size); leaktracer::MemoryTrace::GetInstance().registerAllocation(p, size, true); return p; }
/* malloc * in some malloc implementation, there is a recursive call to malloc * (for instance, in uClibc 0.9.29 malloc-standard ) * we use a InternalMonitoringDisablerThreadUp that use a tls variable to prevent several registration * during the same malloc */ void *malloc(size_t size) { void *p; leaktracer::MemoryTrace::Setup(); leaktracer::MemoryTrace::InternalMonitoringDisablerThreadUp(); p = LT_MALLOC(size); leaktracer::MemoryTrace::InternalMonitoringDisablerThreadDown(); leaktracer::MemoryTrace::GetInstance().registerAllocation(p, size, false); return p; }
E * allocate() { return (E*) LT_MALLOC( NumOfElementsInChunk * sizeof(E) ); }