Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incremental builds occupy a lot of space. (19GB for a small sized project) #48172

Closed
AlexEne opened this issue Feb 12, 2018 · 11 comments
Closed
Labels
A-incr-comp Area: Incremental compilation C-bug Category: This is a bug. I-compilemem Issue: Problems and improvements with respect to memory usage during compilation.

Comments

@AlexEne
Copy link
Member

AlexEne commented Feb 12, 2018

I originally posted this on the RLS bug tracker ( rust-lang/rls#709 ) and it was suggested to open an issue here.

These builds in the RLS subfolder generate a lot of files that eat up a high amount of disk space for the project I am working on. (19 GB)
All this in target/rls/debug/incremental/

For a project that's about a few thousand lines of code, it uses around 16GB of disk space. Now I am unsure of what generates this, I use RLS as part of visual studio code.
All the files are generated while I worked on my project today: (11 Feb 2018). Or they were at least modified today.

rls_disk_space_usage

For reference this is the lines of code output for my project (not too big).
loc

If you want to reproduce the issue, I can give you access to my repo, or we can work something out.

@sfackler sfackler added the A-incr-comp Area: Incremental compilation label Feb 13, 2018
@sfackler
Copy link
Member

cc @michaelwoerister

@michaelwoerister
Copy link
Member

For some reason session directory garbage collection seems to be broken here. There should only ever be a couple of those directories starting with s-.

As a quick workaround, you can just delete all of these directories while no rustc instance is running.

Has anybody observed this on platforms other than Windows?

@michaelwoerister
Copy link
Member

@nrc, will a rustc invocation done by the RLS ever hit this line:

rustc_incremental::finalize_session_directory(sess, trans.link.crate_hash);

This call seems to in the wrong place anyway, since it is not trans-backend specific. I'll look into moving that to the correct spot.

@AlexEne
Copy link
Member Author

AlexEne commented Feb 13, 2018

Thanks for the help.

@kennytm kennytm added I-compilemem Issue: Problems and improvements with respect to memory usage during compilation. A-rls C-bug Category: This is a bug. labels Feb 13, 2018
@kjeremy
Copy link

kjeremy commented Feb 13, 2018

@michaelwoerister yes I see this on Ubuntu 16.04

@nrc
Copy link
Member

nrc commented Feb 14, 2018

@michaelwoerister we skip trans completely, so I would expect that it won't hit that. I have not verified though.

@michaelwoerister
Copy link
Member

@nrc, I've taken a look yesterday and --emit metadata should also go through LLVM trans, so the RLS should hit the finalization if it compiles everything successfully. When there are errors, it may exit early though. #48181 makes sure that we don't rely on successful builds for running the garbage collection. Let's see if that solves the problem.

kennytm added a commit to kennytm/rust that referenced this issue Feb 14, 2018
…ization, r=nikomatsakis

incr.comp.: Run cache directory garbage collection before loading dep-graph.

Prior to this PR, the incr. comp. cache directory would only be garbage collected after the final output artifacts were generated. However, compilation often aborts earlier and in the case of the RLS, which starts lots of compilation sessions, we might fill up the cache directory with chunk sessions.

This PR makes the compiler do a garbage collection run before loading the dep-graph.

cc @nrc rust-lang#48172

r? @nikomatsakis
@ishitatsuyuki
Copy link
Contributor

Disagree that this is I-compilemem as this is disk space not RSS.

@michaelwoerister
Copy link
Member

michaelwoerister commented Mar 1, 2018

Do we know if #48181 has fixed this problem? Can somebody check with a nightly version of the RLS?

@AlexEne
Copy link
Member Author

AlexEne commented Mar 2, 2018

Looks fine now. target/debug/rls/incremental folder has just two other folders in it. build_script_build-idand dwarf_game-id. Thanks for fixing this.

@michaelwoerister
Copy link
Member

Excellent, thanks for confirming, @AlexEne!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-incr-comp Area: Incremental compilation C-bug Category: This is a bug. I-compilemem Issue: Problems and improvements with respect to memory usage during compilation.
Projects
None yet
Development

No branches or pull requests

7 participants