On 2016.03.03 at 09:16 -0500, Patrick Palka wrote:
> push_to_top_level gets called fairly frequently in template-heavy code
> that performs a lot of instantiations, and we currently "leak" a lot of
> GC memory when compiling such code since [push|pop]_to_top_level() do
> not bother reusing or even freeing each saved_scope structure it
> allocates.
> 
> This patch makes push_to_top_level() reuse the saved_scope structures it
> allocates.  This is similar to how begin_scope() reuses the
> cp_binding_level structures it allocates.
> 
> This patch reduces the maximum memory usage of the compiler by 4.5%,
> from 525MB to 500MB, when compiling the Boost::Fusion test file
> libs/fusion/test/compile_time/transform.cpp from the Boost 1.60 testsuite.
> 
> Bootstrapped and tested on x86_64-pc-linux-gnu, OK for
> trunk or for GCC 7?

Great. push_to_top_level also shows up very high in profiles when
building Chromium for example. 

There is an old bug for this issue:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64500

-- 
Markus

Reply via email to