@@ -44,7 +44,6 @@ std::atomic<size_t> indexAllocation(0);
4444std::atomic<size_t > indexDeallocation (0 );
4545bool logTraces = false ;
4646int fastLeakDetectionMode = 0 ;
47- bool memsetNewAllocations = false ;
4847
4948AllocationEvent eventsAllocated[maxEvents];
5049AllocationEvent eventsDeallocated[maxEvents];
@@ -246,40 +245,23 @@ using MemoryManagement::allocate;
246245using MemoryManagement::AllocationEvent;
247246using MemoryManagement::deallocate;
248247
249- NO_SANITIZE
250- inline void initMemory (void *p, size_t size) {
251- if ((p == nullptr ) || (false == MemoryManagement::memsetNewAllocations)) {
252- return ;
253- }
254-
255- memset (p, 0 , size);
256- }
257-
258248#if defined(_WIN32)
259249#pragma warning(disable : 4290)
260250#endif
261251void *operator new (size_t size) {
262- void *p = allocate<AllocationEvent::EVENT_NEW, AllocationEvent::EVENT_NEW_FAIL>(size);
263- initMemory (p, size);
264- return p;
252+ return allocate<AllocationEvent::EVENT_NEW, AllocationEvent::EVENT_NEW_FAIL>(size);
265253}
266254
267255void *operator new (size_t size, const std::nothrow_t &) noexcept {
268- void *p = allocate<AllocationEvent::EVENT_NEW_NOTHROW, AllocationEvent::EVENT_NEW_NOTHROW_FAIL>(size, std::nothrow);
269- initMemory (p, size);
270- return p;
256+ return allocate<AllocationEvent::EVENT_NEW_NOTHROW, AllocationEvent::EVENT_NEW_NOTHROW_FAIL>(size, std::nothrow);
271257}
272258
273259void *operator new [](size_t size) {
274- void *p = allocate<AllocationEvent::EVENT_NEW_ARRAY, AllocationEvent::EVENT_NEW_ARRAY_FAIL>(size);
275- initMemory (p, size);
276- return p;
260+ return allocate<AllocationEvent::EVENT_NEW_ARRAY, AllocationEvent::EVENT_NEW_ARRAY_FAIL>(size);
277261}
278262
279263void *operator new [](size_t size, const std::nothrow_t &t) noexcept {
280- void *p = allocate<AllocationEvent::EVENT_NEW_ARRAY_NOTHROW, AllocationEvent::EVENT_NEW_ARRAY_NOTHROW_FAIL>(size, std::nothrow);
281- initMemory (p, size);
282- return p;
264+ return allocate<AllocationEvent::EVENT_NEW_ARRAY_NOTHROW, AllocationEvent::EVENT_NEW_ARRAY_NOTHROW_FAIL>(size, std::nothrow);
283265}
284266
285267void operator delete (void *p) noexcept {
0 commit comments