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 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
Since it's a useful feature, hardened_malloc has a malloc_info implementation for usage outside Android using the same stats infrastructure. It's the same information provided via malloc_info by Bionic with a slightly cleaned up format. It's not meant to be feature rich though.