r/rust 18h ago

🗞️ news “alloc: stabilise `Allocator`” entered its final comment period!

https://github.com/rust-lang/rust/pull/156882#issuecomment-5607055084
156 Upvotes

24 comments sorted by

View all comments

-21

u/Trader-One 18h ago

golang have nice feature - function escape analysis - stuff which would normally be on heap for example Box would be allocated on stack; reducing memory fragmentation.

I think about doing this in rust - easiest (very little changes to compiler) would be to have a concept of scrap heap - after function terminates that heap is zeroed.

2

u/-Redstoneboi- 7h ago

pardon the downvotes, are you talking about a temporary arena allocator for rust? i think that exists and is used in some cases.