http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54345
Bug #: 54345 Summary: jump threading leaks e->aux heap memory Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Keywords: memory-hog Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassig...@gcc.gnu.org ReportedBy: rgue...@gcc.gnu.org valgrind shows ==30772== 64 bytes in 4 blocks are definitely lost in loss record 15,347 of 29,883 ==30772== at 0x4C29ADD: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==30772== by 0xCE28C7: xmalloc (xmalloc.c:147) ==30772== by 0x99C8E8: thread_through_all_blocks(bool) (tree-ssa-threadupdate.c:1134) ==30772== by 0x92BDCF: tree_ssa_dominator_optimize() (tree-ssa-dom.c:790) ==30772== by 0x818C3A: execute_one_pass(opt_pass*) (passes.c:2157) ==30772== by 0x818F84: execute_pass_list(opt_pass*) (passes.c:2212) ==30772== by 0x818F96: execute_pass_list(opt_pass*) (passes.c:2213) ==30772== by 0x68F583: expand_function(cgraph_node*) (cgraphunit.c:1609) ==30772== by 0x6909E8: compile() (cgraphunit.c:1714) ==30772== by 0x690F64: finalize_compilation_unit() (cgraphunit.c:2089) ==30772== by 0x564956: cp_write_global_declarations() (decl2.c:4024) ==30772== by 0x8AABF4: compile_file() (toplev.c:560) that would be easily solvable by using an obstack for the allocation of the two pointers. That would be cheaper as well. It's lifetime would be thread_through_all_blocks ().