cargo-outdated: Memory usage is high, resulting in Out of memory OS kill
When running cargo outdated on a repository with many small crates (46), this error appears after a while:
cargo outdated
[1] 5557 killed cargo outdated
The system is Ubuntu 16.04 with 8 GB physical memory. Investigating with:
dmesg | less
gives:
[22541.218190] Out of memory: Kill process 5557 (cargo-outdated) score 611 or sacrifice child
[22541.218196] Killed process 5557 (cargo-outdated) total-vm:8599764kB, anon-rss:5518604kB, file-rss:4kB, shmem-rss:0kB
[22541.529600] oom_reaper: reaped process 5557 (cargo-outdated), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB
I haven’t checked code, but if it’s trying to compile the whole repo in /tmp which is mounted on my RAM, perhaps that explains it.
Can see from this graph that the memory usage (green) spikes before it’s killed:

A proposed fix is to take in a parameter for the temporary location to compile. Maybe there’s some parts of the code that can be memory optimized as well.
About this issue
- Original URL
- State: open
- Created 6 years ago
- Comments: 18 (6 by maintainers)
I’m sorry that happened 😞 But thank you for providing that project as this really helps and I was able to reproduce the unbounded memory growth which makes me thing it’s some cyclic dependency.
It still happens on the workspace mentioned here with rustc 1.70 and cargo-outdated 0.13.1
Btw, are you using a workspace, where the root crate is non-virtual (aka has source code)?
edit: With version 0.8.0, in my workspace that has 60 member crates, on my Windows box with 16 gigs of memory, it just hangs.
ran for 3 hours, using 13 gb memory before I cancelled it
Interrupted it to show how long it was running:
with `--depth 8` specified it ends in 9 minutes, but says everything is up to date
Just wanted to note that it works without such problems here on 35 root dependencies (at 340 dependencies to build). With max of 119MB heap, taking 1 second.