Use atomics for allocation counter
I was getting cases where the CPU cache was causing issues with the allocation counter, for the longest time I thought I was doing something wrong, but when the allocation counter went below 0, I realized it was because I didn't use atomics for incrementing/decrementing the allocation counter variable. The allocation counter now always should have the correct value.
This commit is contained in:
@@ -233,7 +233,6 @@ int main(int argc, char *argv[])
|
||||
blog(LOG_ERROR, "%s", error);
|
||||
}
|
||||
|
||||
blog(LOG_INFO, "Number of memory leaks: %llu",
|
||||
(unsigned long long int)bnum_allocs());
|
||||
blog(LOG_INFO, "Number of memory leaks: %ld", bnum_allocs());
|
||||
return ret;
|
||||
}
|
||||
|
Reference in New Issue
Block a user