Summary:
The author recounts their experience encountering excessive memory usage in their Rust project and the process of identifying and resolving the issue. The problem was traced back to the Vec data structure, which was allocating more memory than necessary. The author discovered that calling shrink_to_fit() or using into_boxed_slice() instead of collect() resolved the memory leak. The author also notes that the issue is specific to certain versions of Rust and provides insights into the underlying causes of the problem.
https://blog.polybdenum.com/2024/01/17/identifying-the-collect-vec-memory-leak-footgun.html