Improve reliability of memory stats

The allocation count is managed atomically and where it actually should
change (for instance, not counting an allocation before its success has
been checked).

Bonus: Improve readability of the pre-pad checks.
This commit is contained in:
Pedro J. Estébanez 2017-07-05 10:15:42 +02:00
parent 0b776f9a30
commit 490a2ff0b9
2 changed files with 28 additions and 52 deletions

View file

@ -48,8 +48,7 @@ class Memory {
static size_t mem_usage;
static size_t max_usage;
#endif
static size_t alloc_count;
static uint64_t alloc_count;
public:
static void *alloc_static(size_t p_bytes, bool p_pad_align = false);