Closed
Description
Test Case
To reproduce, download the two files in this gist and attempt to build mkrust.rs
:
https://gist.github.com/bkoropoff/537951c596ba24166f06
Analysis
The complex json.query(...)
expression in mkrust.rs
seems to be the culprit. Progressively simplifying the expression will eventually cause the bug to no longer reproduce.
Running rustc under massif yields the following (truncated for space) stack for the primary memory hog, which appears to be a hash map associated with region inference:
99.25% (522,819,638B) (heap allocation functions) malloc/new/new[], --alloc-fns, etc.
->68.00% (358,203,360B) 0x7E5562C: je_mallocx (in /home/bkoropoff/Software/rust/lib/librustrt-d8560cb2-0.11.0-pre.so)
| ->50.16% (264,241,152B) 0x57AF077: collections::hashmap::table::RawTable$LT$K$C$$x20V$GT$::new::h16071681466547729146::v0.11.0.pre (in /home/bkoropoff/Software/rust/lib/librustc-d252d482-0.11.0-pre.so)
| | ->50.16% (264,241,152B) 0x57B1D51: collections::hashmap::HashMap$LT$K$C$$x20V$C$$x20H$GT$::resize::h9544924386944675449::v0.11.0.pre (in /home/bkoropoff/Software/rust/lib/librustc-d252d482-0.11.0-pre.so)
| | | ->50.16% (264,241,152B) 0x57B81D1: middle::typeck::infer::region_inference::RegionVarBindings$LT$$x27a$GT$::add_constraint::he966b592d2e519c2Sxo::v0.11.0.pre (in /home/bkoropoff/Software/rust/lib/librustc-d252d482-0.11.0-pre.so)
| | | ->50.16% (264,241,152B) 0x57BA642: middle::typeck::infer::region_inference::RegionVarBindings$LT$$x27a$GT$::make_subregion::h5a25349bdfe40532sBo::v0.11.0.pre (in /home/bkoropoff/Software/rust/lib/librustc-d252d482-0.11.0-pre.so)
| | | | ->50.16% (264,241,152B) 0x57BC9F6: middle::typeck::infer::region_inference::RegionVarBindings$LT$$x27a$GT$::lub_regions::closure.93817 (in /home/bkoropoff/Software/rust/lib/librustc-d252d482-0.11.0-pre.so)
| | | | | ->50.16% (264,241,152B) 0x57BC0D0: middle::typeck::infer::region_inference::RegionVarBindings$LT$$x27a$GT$::combine_vars::h5ec95b92851d887cDUo::v0.11.0.pre (in /home/bkoropoff/Software/rust/lib/librustc-d252d482-0.11.0-pre.so)
| | | | | | ->50.16% (264,241,152B) 0x57A23E6: middle::typeck::infer::region_inference::RegionVarBindings$LT$$x27a$GT$::lub_regions::hc2ef972d6db9d001eIo::v0.11.0.pre (in /home/bkoropoff/Software/rust/lib/librustc-d252d482-0.11.0-pre.so)
| | | | | | ->50.16% (264,241,152B) 0x578A07A: middle::typeck::infer::lub::Lub$LT$$x27f$GT$.Combine::regions::h96b097927410ccd30sn::v0.11.0.pre (in /home/bkoropoff/Software/rust/lib/librustc-d252d482-0.11.0-pre.so)