derive(Debug) on huge enum causes massive memory spike during liveness checking #50450
Labels
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
I-compilemem
Issue: Problems and improvements with respect to memory usage during compilation.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Discovered on twitter: https://twitter.com/malwareunicorn/status/992438462652403713
#[derive(Debug)]
on an enum with 10,000 variants causes a 7GB spike.#[derive(Debug)]
on an enum with 20,000 variants causes a massive 28GB spike.20,000 variant code to reproduce: https://gist.github.com/retep998/fdddd37aea38c5d2bfacbf63773e2417
Time passes from 20,000 variant build which doesn't show the massive spike (in fact it shows the opposite because the massive spike pushed most of rustc's memory usage into the page file):
The massive spike:
The text was updated successfully, but these errors were encountered: