rust-gamedev / wg

Coordination repository of the Game Development Working Group
511 stars 10 forks source link

Working with Multiple Heaps #47

Open aclysma opened 5 years ago

aclysma commented 5 years ago

(Credit to @jaynus for bringing this up!)

In game development, it’s common practice to have multiple heaps.

Common Usecases:

As far as I can tell, Rust's support for custom allocation is incomplete, but being worked on. There is a working group to try to address this: (https://github.com/rust-lang/wg-allocators/issues). It looks to me like there is general consensus around what to do, it just isn't done yet. However, much of it is available in nightly.

There is an open issue to add an allocator type param for Box, Rc, String, Vec, and other collections/pointer-like types (https://github.com/rust-lang/wg-allocators/issues/7). For now it looks like it is blocked by https://github.com/rust-lang/wg-allocators/issues/2)

I can think of two temporary workarounds for having multiple heaps, but there may be others:

I suspect that the work needed to solve most needs for game development is already queued up, and if all of that work were completed and stabilized, I think Rust would be in good shape here.

Wodann commented 4 years ago

Also, see #60.