Hacker News new | past | comments | ask | show | jobs | submit login

Conceptually, collect seems to create a new vector. In that case you would expect that the memory of the old vector is freed. The library tries to be smart and reuses the old vector as an (undocumented?) optimization. So the old memory that is no longer needed is not released.

Whether you call that a leak or not, Rust is known for its predictability. Allocating 200x the memory which a programmer would expect if he doesn't know the implementation details is bad.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: