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:
jp9000
2014-04-07 01:25:38 -07:00
parent 906535022f
commit fd24d0de2f
3 changed files with 8 additions and 8 deletions

View File

@@ -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;
}