Guardedalloc: Don't use aligned blocks to calculate memory sloppyness
authorSergey Sharybin <sergey.vfx@gmail.com>
Mon, 20 Apr 2015 14:23:25 +0000 (19:23 +0500)
committerSergey Sharybin <sergey.vfx@gmail.com>
Mon, 20 Apr 2015 14:23:25 +0000 (19:23 +0500)
Aligned memory is allocated with memalign() and malloc_usable_size() can't be
used to measure this block.

intern/guardedalloc/intern/mallocn_guarded_impl.c

index bdcace243d909c2b3d609d5cf28ee44d9dccc1d9..88d6f35d4380b2810af39ec8e0203e6904c1105b 100644 (file)
@@ -711,7 +711,7 @@ void MEM_guarded_printmemlist_stats(void)
                totpb++;
                pb++;
 
-               if (!membl->mmap) {
+               if (!membl->mmap && membl->alignment == 0) {
                        mem_in_use_slop += (sizeof(MemHead) + sizeof(MemTail) +
                                            malloc_usable_size((void *)membl)) - membl->len;
                }