-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Labels
A-console-outputArea: Terminal output, colors, progress bar, etc.Area: Terminal output, colors, progress bar, etc.
Description
Problem
When cargo invokes rustc or rustdoc (via cargo doc or cargo build, the child process's entire stdout is kept in memory. This can lead to the system's memory being completely exhausted if rustc or rustdoc produce a lot of output (e.g. when RUST_LOG is set).
Steps
- Create a file called
yes.shcontaining the stringyes(If theyesprogram is unavailable, replace it with a script that endlessly writes to stdout) - Run
chmod +x ./yes.sh - Run
RUSTC=./yes.sh cargo buildin any crate directory. - Observe that cargo's memory usage quickly rises to consume all available memory.
Possible Solution(s)
cargo should clear each line of a child command's stdout from memory once it has been printed, since it won't be needed again.
Notes
Output of cargo version: cargo 1.29.0 (524a578d7 2018-08-05)
Tested on Arch Linux - this should be reproducible on any Linux-based system.
Metadata
Metadata
Assignees
Labels
A-console-outputArea: Terminal output, colors, progress bar, etc.Area: Terminal output, colors, progress bar, etc.