Skip to content

Commit

Permalink
Don't log memory tracker state multiple times
Browse files Browse the repository at this point in the history
  • Loading branch information
MatejKafka committed May 29, 2021
1 parent 142e4cc commit 0a09f65
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/memory_tracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,18 @@ static bool log_allocations = false;

void memory_tracker::enable()
{
log_allocations = true;
logger->info("Heap allocation logging enabled");
if (!log_allocations) {
log_allocations = true;
logger->info("Heap allocation logging enabled");
}
}

void memory_tracker::disable()
{
log_allocations = false;
logger->info("Heap allocation logging disabled");
if (log_allocations) {
log_allocations = false;
logger->info("Heap allocation logging disabled");
}
}

void *operator new(size_t size)
Expand Down

0 comments on commit 0a09f65

Please sign in to comment.