Rename fastLeakDetectionMode -> fastLeakDetectionEnabled

Change-Id: I5a35b2bb9a3ccea9b8e52660f3713b925fe5f607
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2019-03-04 10:17:32 +01:00
committed by sys_ocldev
parent 075155af5f
commit 00184c4e2e
4 changed files with 16 additions and 16 deletions

View File

@ -30,7 +30,7 @@ std::atomic<size_t> numAllocations(0);
std::atomic<size_t> indexAllocation(0);
std::atomic<size_t> indexDeallocation(0);
bool logTraces = false;
int fastLeakDetectionMode = 0;
bool fastLeakDetectionEnabled = false;
AllocationEvent eventsAllocated[maxEvents];
AllocationEvent eventsDeallocated[maxEvents];
@ -83,7 +83,7 @@ static void *allocate(size_t size) {
return nullptr;
}
if (!fastLeakDetectionMode) {
if (!fastLeakDetectionEnabled) {
return malloc(size);
}
@ -112,14 +112,14 @@ static void *allocate(size_t size) {
#else
eventAllocation.frames = 0;
#endif
eventAllocation.fastLeakDetectionMode = fastLeakDetectionMode;
eventAllocation.fastLeakDetectionEnabled = fastLeakDetectionEnabled;
numAllocations++;
} else {
p = malloc(size);
}
if (fastLeakDetectionMode && p && fastLeaksDetectionMode == LeakDetectionMode::STANDARD) {
if (fastLeakDetectionEnabled && p && fastLeaksDetectionMode == LeakDetectionMode::STANDARD) {
auto currentIndex = fastEventsAllocatedCount++;
fastEventsAllocated[currentIndex] = p;
assert(currentIndex <= fastEvents);
@ -136,7 +136,7 @@ static void *allocate(size_t size, const std::nothrow_t &) {
return nullptr;
}
if (!fastLeakDetectionMode) {
if (!fastLeakDetectionEnabled) {
return malloc(size);
}
@ -164,13 +164,13 @@ static void *allocate(size_t size, const std::nothrow_t &) {
#else
eventAllocation.frames = 0;
#endif
eventAllocation.fastLeakDetectionMode = fastLeakDetectionMode;
eventAllocation.fastLeakDetectionEnabled = fastLeakDetectionEnabled;
numAllocations += p ? 1 : 0;
} else {
p = malloc(size);
}
if (fastLeakDetectionMode && p && fastLeaksDetectionMode == LeakDetectionMode::STANDARD) {
if (fastLeakDetectionEnabled && p && fastLeaksDetectionMode == LeakDetectionMode::STANDARD) {
auto currentIndex = fastEventsAllocatedCount++;
fastEventsAllocated[currentIndex] = p;
assert(currentIndex <= fastEvents);
@ -183,7 +183,7 @@ template <AllocationEvent::EventType typeValid>
static void deallocate(void *p) {
deleteCallback(p);
if (!fastLeakDetectionMode) {
if (!fastLeakDetectionEnabled) {
if (p) {
free(p);
}
@ -209,11 +209,11 @@ static void deallocate(void *p) {
#else
eventDeallocation.frames = 0;
#endif
eventDeallocation.fastLeakDetectionMode = fastLeakDetectionMode;
eventDeallocation.fastLeakDetectionEnabled = fastLeakDetectionEnabled;
}
free(p);
if (fastLeakDetectionMode && p && fastLeaksDetectionMode == LeakDetectionMode::STANDARD) {
if (fastLeakDetectionEnabled && p && fastLeaksDetectionMode == LeakDetectionMode::STANDARD) {
auto currentIndex = fastEventsDeallocatedCount++;
fastEventsDeallocated[currentIndex] = p;
assert(currentIndex <= fastEvents);

View File

@ -47,7 +47,7 @@ struct AllocationEvent {
size_t size;
int frames;
void *callstack[CallStackSize];
int fastLeakDetectionMode = 0;
bool fastLeakDetectionEnabled = false;
};
enum : int {
maxEvents = 1024 * 1024,
@ -71,7 +71,7 @@ extern size_t breakOnAllocationEvent;
extern size_t breakOnDeallocationEvent;
extern bool logTraces;
extern bool detailedAllocationLoggingActive;
extern int fastLeakDetectionMode;
extern bool fastLeakDetectionEnabled;
extern void (*deleteCallback)(void *);
int detectLeaks();