3 ms·
That just has allocation, but no way to reset the arena & reclaim its memory. But then again, you'd have to make it so no allocations from the arena are alive &
by whateveracct 6y ago
That just has allocation, but no way to reset the arena & reclaim its memory. But then again, you'd have to make it so no allocations from the arena are alive & in use when you reset the arena.
Definitely a downside :/ On a side-note: I'm fairly sure the ST trick + -XLinearTypes will allow a better & still type-safe arena allocator to be written in Haskell than is currently possible in Rust.
- gpm 6y ago> but no way to reset the arena & reclaim its memory. But then again, you'd have to make it so no allocations from the arena are alive & in use when you reset the arena Looks like that implementation doesn't, but the borrow checker can definitely specify that sort of constraint (it looks `fn foo(self) -> Self`). I think it's not exposed because the code assumes that all but the last chunk are completely filled - but it could also just be that no one asked for that.
- pornel 6y agoBorrows are scope based, so if you limit arena usage to a scope (e.g. inside your frame loop), then it should be fairly trivial to reset it. Reclaiming should theoretically be possible too via a method that takes ownership of the arena (the borrow checker prevents moves while an object is borrowed).
- whateveracct 6y agohm interesting - so basically, the blocks you borrow from the arena can be scoped to be <= the scope of the arena itself, which will then make them respect a reset?