Reduce memory usage
Opened this issue · 2 comments
Memory usage of cargo tally
can get quite severe. Running cargo tally winapi windows-sys
peaked at 12.7 GB, which isn't terrible (but also far from great). However, when trying it with --transitive
, the program exhausts my 32 GB of RAM and 8 GB of swap before Linux kills it as OOM, so it apparently uses in excess of 40 GB.
Is it somehow possible to reduce the amount of memory used? I don't mind if it takes longer to run; the speed is reasonable as-is. Perhaps if some data could be written to disk (and later read back as needed) if memory usage exceeds a threshold?
On my machine cargo tally winapi windows-sys --transitive
uses 38.2 GB peak, of which the peak amount allocated by Rust is 29.3 GB, and the rest is presumably heap fragmentation or something (I don't know much about this space).
In any case I have a lot more than that, and have never hit OOMs despite using this crate a lot (including concurrent invocations), so I don't plan to look into this, but I would be open to PRs.
![](https://private-user-images.githubusercontent.com/1940490/259238410-da8a5a1f-7bfc-4118-8b66-343330f5af6b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjUwMzU0ODMsIm5iZiI6MTcyNTAzNTE4MywicGF0aCI6Ii8xOTQwNDkwLzI1OTIzODQxMC1kYThhNWExZi03YmZjLTQxMTgtOGI2Ni0zNDMzMzBmNWFmNmIucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDgzMCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA4MzBUMTYyNjIzWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZmNmOTYwZjhlMjhhODQzY2FlNWUzY2RhNWUyMTFjMTUyMjI5YWUwOGE3ZjA1YWE3MDI0OGUyNmVlNWVhZTNkNyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.WysxGuC_FFJWyVgVdek8xk06kKttXK1N975BXoqvHic)
That's reasonable. I don't use it often myself, so it's not a huge deal. Given my infrequency of use, I likely won't spend much time (if any) looking at ways to reduce the memory usage.
Feel free to close this unless you'd rather leave it open as "acceptable, but I'm not doing it".