This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH 06/21] PR jit/63854: Fix leak of opts_obstack
- From: David Malcolm <dmalcolm at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org, jit at gcc dot gnu dot org
- Cc: David Malcolm <dmalcolm at redhat dot com>
- Date: Wed, 19 Nov 2014 05:46:06 -0500
- Subject: [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>
This was leaking about 4KB per iteration:
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