hardened_malloc icon indicating copy to clipboard operation
hardened_malloc copied to clipboard

consider switching from hash table for large allocations to an arena-based red-black tree to satisfy range requests for malloc_object_size

Open thestinger opened this issue 7 years ago • 3 comments

The current implementation will lead to only being able to provide size results for offsets into the initial page(s) of a large allocation, since with a hash table there isn't a way to find the closest previous match.

This would have a performance cost compared to the hash table for allocation, and would also make malloc_object_size significantly slower. It might make sense as a configuration option, or perhaps it's not worth doing at all.

thestinger avatar Sep 05 '18 11:09 thestinger

Hi, I was wondering if this issue has been resolved? If not, I'd be interested to take this issue on. However, I've only created a memory allocator with a first fit policy + segregated free list due to coursework. I have a vague idea of how an arena-based red black tree implementation might work, but are there any papers you could point me to to fully grasp how this might work?

asder8215 avatar Dec 01 '25 04:12 asder8215

Hi, I was wondering if this issue has been resolved?

No, but it's an extremely low priority and not really useful to GrapheneOS anymore. There are many much higher priority features.

thestinger avatar Dec 01 '25 04:12 thestinger

Understood. Are there any other issues I should take a look at and attempt to work on?

For context, my primary background is mostly C and Rust; the former I have done in the context of university coursework with building things like memory allocators, linker, debugger, OS and a bit of Embedded System related stuff and the latter I mostly work on on my own time writing async multithreaded code, command line utilities, and contributing to open source software.

asder8215 avatar Dec 01 '25 05:12 asder8215