News for hackers. Stuff that matters.
Re:Why I Write Games in C (yes, C) by Matthias247 on Saturday September 21, 2019 @04:23PM (#21037708)
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.
Re:Why I Write Games in C (yes, C) by fluffything on Sunday September 22, 2019 @09:23AM (#21041243)
> 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`.

Re:Why I Write Games in C (yes, C) by minxomat on Saturday September 21, 2019 @06:46PM (#21038365)
Seems like lifeguard could solve this: https://github.com/zslayton/lifeguard