3 ms·
It might be possible that jemalloc already does this? Rust uses it by default, and while I don't recall the specifics jemalloc does a bunch of things in userspa
by Manishearth 10y ago
It might be possible that jemalloc already does this? Rust uses it by default, and while I don't recall the specifics jemalloc does a bunch of things in userspace wrapped around malloc that make it better than malloc.
Rust makes it easy to swap out the allocator too, so I'd love to see an allocator lib specifically focused on size management :)
- Jweb_Guru 10y agoYes, this is precisely how jemalloc works.
- vvanders 10y agoDoes jemalloc allow you to report telemetry and feed that back into the initial pool sizes? That's what makes the gamedev oriented allocators interesting. FWIW a "Frame allocator" was always a block of memory where malloc returned pointer into the block and advanced the pointer. At the end of rendering a frame you just reset the pointer to the start of the block. The downside is you need to guarantee that nothing in has a lifetime longer than a frame, something Rust should be good at :). I think what the GP is referring to is a pooling allocator that pools similar sized allocations.
- Jweb_Guru 10y ago> Does jemalloc allow you to report telemetry and feed that back into the initial pool sizes? That's what makes the gamedev oriented allocators interesting. Not AFAIK. There are a lot of optimizations it's quite difficult to do with dynamic pool sizes, which aren't worthwhile in the general case.
- rayiner 10y agoAnd OS X's magazine allocator, in addition to probably dozens of others. Segregated-fit allocators are probably the dominant method.