Guardedalloc: Reset peak memory should set peak to currently allocated memory
authorSergey Sharybin <sergey.vfx@gmail.com>
Thu, 19 Feb 2015 08:14:06 +0000 (13:14 +0500)
committerSergey Sharybin <sergey.vfx@gmail.com>
Thu, 19 Feb 2015 08:14:06 +0000 (13:14 +0500)
Otherwise statistics could be really funny looking.

intern/guardedalloc/intern/mallocn_guarded_impl.c
intern/guardedalloc/intern/mallocn_lockfree_impl.c

index 9a503422282c239105a229c1c29fdc83e09c272e..bdcace243d909c2b3d609d5cf28ee44d9dccc1d9 100644 (file)
@@ -1148,7 +1148,7 @@ size_t MEM_guarded_get_peak_memory(void)
 void MEM_guarded_reset_peak_memory(void)
 {
        mem_lock_thread();
-       peak_mem = 0;
+       peak_mem = mem_in_use;
        mem_unlock_thread();
 }
 
index b5f3d1b15dc73e15b27d59bd650fec815ff123ec..a80d67c3e80c53928fe59fa25305985578da7c02 100644 (file)
@@ -478,7 +478,7 @@ unsigned int MEM_lockfree_get_memory_blocks_in_use(void)
 /* dummy */
 void MEM_lockfree_reset_peak_memory(void)
 {
-       peak_mem = 0;
+       peak_mem = mem_in_use;
 }
 
 size_t MEM_lockfree_get_peak_memory(void)