This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Reuse the saved_scope structures allocated by push_to_top_level
- From: Markus Trippelsdorf <markus at trippelsdorf dot de>
- To: Patrick Palka <patrick at parcs dot ath dot cx>
- Cc: gcc-patches at gcc dot gnu dot org, jason at redhat dot com
- Date: Thu, 3 Mar 2016 15:22:45 +0100
- Subject: Re: [PATCH] Reuse the saved_scope structures allocated by push_to_top_level
- Authentication-results: sourceware.org; auth=none
- References: <1457014595-5593-1-git-send-email-patrick at parcs dot ath dot cx>
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