Conversation

Hi out of curiosity was playin with hardened_malloc to detect memory leak and from observation, seems that it can't detect memry leak issues if I understood it correctly? even I comp'd it with CONFIG_STATS which seems not understandable,here 🤔 Am I mising smtng?
Image
Image
1
Please read github.com/GrapheneOS/har. It's a hardened memory allocator. It defends against exploitation of memory corruption bugs. It's also not intended as a debugging or auditing tool. Memory leaks aren't memory corruption bugs and aren't relevant to what it defends against.
1
2
The stats about you posted also shows that a 16 byte allocation was allocated and freed, and a 32 byte allocation was allocated but not freed. A 12 byte allocation becomes a 20 byte allocation after reserving space for the 8 byte canary, and the next size after 16 bytes is 32.
1
The stats feature was mainly implemented for full compatibility with the standard allocator (an extended jemalloc) on Android. The Android Runtime's garbage collector uses it and Bionic implements malloc_info for performance/memory analysis tools based on the same low-level APIs.
1