2

fix: Vec leak when capacity is 0 by SparkyPotato · Pull Request #95699 · rust-la...

 2 years ago
source link: https://github.com/rust-lang/rust/pull/95699
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Copy link

Contributor

@SparkyPotato SparkyPotato commented 12 days ago

edited

When RawVec::with_capacity_in is called with capacity 0, an allocation of size 0 is allocated.
However, <RawVec as Drop>::drop doesn't deallocate, since it only checks if capacity was 0. Fixed by not allocating when capacity is 0.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK