Skip to content

Commit 55901f3

Browse files
Remove unused methods and code.
Change-Id: Ie6d15e6f56383e491240b4868f4746aee5fa8ddc
1 parent 524737a commit 55901f3

File tree

1 file changed

+4
-22
lines changed

1 file changed

+4
-22
lines changed

unit_tests/helpers/memory_management.cpp

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ std::atomic<size_t> indexAllocation(0);
4444
std::atomic<size_t> indexDeallocation(0);
4545
bool logTraces = false;
4646
int fastLeakDetectionMode = 0;
47-
bool memsetNewAllocations = false;
4847

4948
AllocationEvent eventsAllocated[maxEvents];
5049
AllocationEvent eventsDeallocated[maxEvents];
@@ -246,40 +245,23 @@ using MemoryManagement::allocate;
246245
using MemoryManagement::AllocationEvent;
247246
using 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
261251
void *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

267255
void *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

273259
void *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

279263
void *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

285267
void operator delete(void *p) noexcept {

0 commit comments

Comments
 (0)