3 ms·
Do you use any public available crate for those allocators? Would love to take a look. I'm currently trying to write a library for no-std which requires somethi
by Matthias247 7y ago
Do you use any public available crate for those allocators? Would love to take a look. I'm currently trying to write a library for no-std which requires something like that. I currently have written a pool of bump allocators. For each transaction you grab an allocator from the pool, allocate as many objects from it as necessary, and then everything gets freed back to the pool. However it's a bit hacky right now, so I'm wondering whether there is already something better out there.
- minxomat 7y agoSeems like lifeguard could solve this: https://github.com/zslayton/lifeguard https://github.com/zslayton/lifeguard
- fluffything 7y ago> Do you use any public available crate for those allocators? Not really, our bump allocator is ~50 LOC, it just allocates a `Box<[u8]>` with a fixed size on initialization, and stores the index of the currently used memory, and that's it. We then have a `BumpVec<T>` type that uses this allocator (`ptr`, `len`, `cap`). This type has a fixed-capacity, it cannot be moved or cloned, etc. so it ends up being much simpler than `Vec`.