This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 06/21] PR jit/63854: Fix leak of opts_obstack
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: David Malcolm <dmalcolm at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, jit at gcc dot gnu dot org
- Date: Wed, 19 Nov 2014 12:43:45 +0100
- Subject: Re: [PATCH 06/21] PR jit/63854: Fix leak of opts_obstack
- Authentication-results: sourceware.org; auth=none
- References: <1416393981-39626-1-git-send-email-dmalcolm at redhat dot com> <1416393981-39626-7-git-send-email-dmalcolm at redhat dot com>
On Wed, Nov 19, 2014 at 11:46 AM, David Malcolm <dmalcolm@redhat.com> wrote:
> This was leaking about 4KB per iteration:
Ok.
Thanks,
Richard.
> 16,256 bytes in 4 blocks are definitely lost in loss record 233 of 239
> at 0x4A0645D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
> by 0x5D75C17: xmalloc (xmalloc.c:147)
> by 0x30958842DB: _obstack_begin (obstack.c:184)
> by 0x5D1D317: init_options_struct(gcc_options*, gcc_options*) (opts.c:279)
> by 0x532DB0C: toplev::main(int, char**) (toplev.c:2081)
> by 0x4DE766F: gcc::jit::playback::context::compile() (jit-playback.c:1615)
> by 0x4DD76DA: gcc::jit::recording::context::compile() (jit-recording.c:861)
> by 0x4DD5BD2: gcc_jit_context_compile (libgccjit.c:2014)
> by 0x401CA4: test_jit (harness.h:190)
> by 0x401D88: main (harness.h:232)
>
> gcc/ChangeLog:
> PR jit/63854
> * toplev.c (toplev::finalize): Free opts_obstack.
> ---
> gcc/toplev.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/gcc/toplev.c b/gcc/toplev.c
> index 291b84d..0d617c2 100644
> --- a/gcc/toplev.c
> +++ b/gcc/toplev.c
> @@ -2178,4 +2178,6 @@ toplev::finalize (void)
> /* Clean up the context (and pass_manager etc). */
> delete g;
> g = NULL;
> +
> + obstack_free (&opts_obstack, NULL);
> }
> --
> 1.8.5.3
>