2
fix: Vec leak when capacity is 0 by SparkyPotato · Pull Request #95699 · rust-la...
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.
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.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK