3 ms·
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
by asa400 2y 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.
- zozbot234 2y agoManuallyDrop seems overkill when you have Box::leak().
- edflsafoiewq 2y agoYou may also be able to simply exit() before your allocations get dropped.