6 ms·
It seems pretty likely that, at some point in the lifetime of a thread, it will consume a lot of the stack and thus touch those pages. And there isn't a mechani
by noctune 4y ago
It seems pretty likely that, at some point in the lifetime of a thread, it will consume a lot of the stack and thus touch those pages. And there isn't a mechanism for deallocating those pages again, right?
Tying your memory consumption heavily to the max stack depth also seems like it would be difficult to reason about IMO.
- convolvatron 4y agofor me this is the big point. stack-based memory allocation works great as long as your usage and sharing follows the control flow. but when it doesn't, rust really leaves you in a bad spot and you get to play with: - Arcing everything - using a fixed-sized ancillary array and passing indices - creating threads that correspond to the lifetimes you care about - fighting your way through adding explicit lifetime allocations and - delaying reclamation of _everything_ above it on the stack ... and while workable, none of those things are particularly nice
- insanitybit 4y agoIDK, it's pretty easy to just Arc something if it has to be shared across threads. That's what you do in other languages. It's rare that I care to deal with the thread lifetimes themselves.