3 ms·
In rust dynamic allocations usually just end up with runtime asserts from your ref counting gc implementation though.
by tubs 2y ago
In rust dynamic allocations usually just end up with runtime asserts from your ref counting gc implementation though.
- IshKebab 2y agoNo they don't. Most programs are full of dynamic allocations (String, Vec, etc.) with only rare use of RefCell (I assume that's what you're talking about).
- Galanwe 2y agoMost non trivial programs I've seen in Rust just end up with Arc<> and copies all over the place, because getting lifetimes right becomes borderline insanity.
- IshKebab 2y agoIt totally depends on the program. Sometimes you need to use Arc, sometimes you don't. Arc doesn't involve any runtime asserts though and it's not a crime to use it. For example I just ripgrep. Arc is used 29 times, compared to 185 uses of Vec.