-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
major regression in rustc memory usage #6637
Comments
I am interested in that! But comparing stage0 and stage1 is not much to go on: they differ by whatever has happened since the last snapshot. If you (or someone -- I can try to set up a run if nobody else wants to) bisect from the previous snapshot-registering commit to this point, you should find the culprit. |
Does this have to do with the fact that stage0 is built with optimizations, but stage1 isn't? |
No, both versions are opt. I bisected down to either of 1daaf78 or 030c666 : the latter won't build and the former is definitely bad. Doesn't matter, they're both the same pull req. Paging @alexcrichton ? |
@graydon It seems unlikely that either of those commits could explain all of it, though? I noticed huge slowdowns in, for example, typeck and trans, and those commits only appear to affect lint. |
I'd be surprised if either of those were the root cause of this. @catamorphism is right in that those should only affect linting predominately. I can try to investigate this though to make sure that it's not those commits. |
@catamorphism This is about a memory regression, not a speed regression. It only takes one typo to cause a cycle-leak. I'm not certain it's this rev, but it's the one bisect found. As in: the rev before uses 1.8gb to build stage1, this rev uses 2.5gb. I'm not sure what else to say about that; I'll try re-confirming or slicing the history graph differently tomorrow. Gotta do some laundry now. I'm not aware of this being directly connected to a speed regression. Can you find a pick out a time when the build was fast, for you, so that I can bisect that? |
@graydon one thing that would be useful if possible would be differences in the heap graphs over time. If I knew in what stage of the build the memory started deviating largely from what it was before, I could probably see what the problem was. |
@alexcrichton massif can produce those graphs. If you like I can make a pair of them tomorrow; if you have it installed locally it will work the same for you or me. |
that is, |
I ran out of time tonight, but I did manage to get one dump of the bad version of the compiler (https://gist.github.com/alexcrichton/5633336). I was having trouble making either heads or tails of the data... |
From profile 55, which showed 2,283,406,322B of memory usage, we see:
etc. The massif docs have a nice clear explanation of how to read the results. The peak snapshot is usually the most interesting one to analyze. |
When reading, it's important to differentiate local and exchange heap allocations. They are separately reported. |
OK, so here's the result of some more investigation. Before this patch: (rev 918bfa7)
After this patch (rev 1daaf78)
Can you spot the difference? As it turns out, about 700MB was free'd in that drop in the before graph, which is the difference between the before and after. Of this, nearly all of it was from I'm still having trouble understanding how this relates to the lint patch. This definitely didn't touch anything in trans, much less anything in ast encoding/decoding. Any ideas? |
Looking at your before/after logs, it looks like the sidetable decoding costs are present in both: pre:
post:
So I don't think it's that (curious why the logs differ between runs though -- different ms_print binaries?) Anyway, the "drop off" you see in the first graph but not the second is supposed to be the place where we drop all pre-LLVM state we can. If you look in the
The stuff in the block is supposed to get dropped, leaving only This is what I expected was happening. As to why, I'd guess we're making a new cycle that keeps everything alive. We don't have a tracing GC at this point (working on it!), so even one bad cycle will keep very large things alive-and-leaked until task death. I'll keep reading through the code and trying to find such a new cycle, but I'd bet that's what we're seeing. Any further hints from your knowledge of "what the code does" would be appreciated. |
Update: talked to @alexcrichton on IRC and it seems likely this is a cycle between the visitors and the lint context. Meanwhile I made a small patch (#6776) that removes the smallintmap pathology in decoding ASTs, saves 400mb. Please keep looking on this one though! |
Via my super-accurate timing (`/usr/bin/time -l`), I get 2431119360 => 1884430336 == ~520MB Closes #6637.
Just confirmed this after 6264df5. The stage0 peak is around 2.2GB, and the stage1 peak is around 1.5GB |
Yay! |
You can compare the
stage0
andstage1
memory usage at 3a481c0. The peak RES usage compiling librustc has gone from ~1800MiB to ~2400-2500MiB.@graydon: you'll probably be interested in this
The text was updated successfully, but these errors were encountered: