Hacker News new | ask | show | jobs
by asa400 498 days ago
Rust has ManuallyDrop, which is exactly the functionality you’re describing. It works just fine for those types of programs. The speed of the two is going to be largely dependent on the amount of effort that has gone into optimizing either one, not on some theoretical performance bound. They’re both basically the same there. There are tons of examples of this in the wild at this point.
1 comments

ManuallyDrop seems overkill when you have Box::leak().
You may also be able to simply exit() before your allocations get dropped.