[Bug jit/63854] Fix memory leaks seen in JIT
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63854 --- Comment #34 from CVS Commits --- The master branch has been updated by Jeff Law : https://gcc.gnu.org/g:bc84b61b00792ef38e1c2cd6b7280087e4fd2b57 commit r12-7723-gbc84b61b00792ef38e1c2cd6b7280087e4fd2b57 Author: Marc Nieper-Wißkirchen Date: Sat Mar 19 13:42:26 2022 -0400 [PATCH] gcc: pass-manager: Fix memory leak. [PR jit/63854] Before the patch, compiling the hello world example of libgccjit with the external driver under Valgrind shows a loss of 12,611 (48 direct) bytes. After the patch, no memory leaks are reported anymore. (Memory leaks occurring when using the internal driver are mostly in the driver code in gcc/gcc.c and have to be fixed separately.) The patch has been tested by fully bootstrapping the compiler with the frontends C, C++, Fortran, LTO, ObjC, JIT and running the test suite under a x86_64-pc-linux-gnu host. gcc/ChangeLog: PR jit/63854 * hash-traits.h (struct typed_const_free_remove): New. (struct free_string_hash): New. * pass_manager.h: Use free_string_hash. * passes.cc (pass_manager::register_pass_name): Use free_string_hash. (pass_manager::~pass_manager): Delete allocated m_name_to_pass_map.
[Bug jit/63854] Fix memory leaks seen in JIT
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63854 --- Comment #33 from CVS Commits --- The master branch has been updated by Alex Coplan : https://gcc.gnu.org/g:b46584d7836bee011facdf946fd7241c748d66f0 commit r11-2799-gb46584d7836bee011facdf946fd7241c748d66f0 Author: Alex Coplan Date: Fri Aug 21 14:26:11 2020 +0100 driver: Fix several memory leaks [PR63854] This patch fixes several memory leaks in the driver, all of which relate to the handling of static specs. We introduce functions set_static_spec_{shared,owned}() which are used to enforce proper memory management when updating the strings in the static_specs table. This is achieved by making use of the alloc_p field in the table entries. Similarly to set_spec(), each time we update an entry, we check whether alloc_p is set, and free the old value if so. We then set alloc_p correctly based on whether we "own" this memory or whether we're just taking a pointer to a shared string which we shouldn't free. The following table shows the number of leaks found by AddressSanitizer when running a minimal libgccjit program on AArch64. The test program does the whole libgccjit compilation cycle in a loop (including acquiring and releasing the context), and the table below shows the number of leaks for different iterations of that loop. +--+-+-+--+---+ | # of runs > | 1 | 2 | 3| Leaks per run | +--+-+-+--+---+ | Before patch | 463 | 940 | 1417 | 477 | +--+-+-+--+---+ | After patch | 416 | 846 | 1276 | 430 | +--+-+-+--+---+ gcc/ChangeLog: PR jit/63854 * gcc.c (set_static_spec): New. (set_static_spec_owned): New. (set_static_spec_shared): New. (driver::maybe_putenv_COLLECT_LTO_WRAPPER): Use set_static_spec_owned() to take ownership of lto_wrapper_file such that it gets freed in driver::finalize. (driver::maybe_run_linker): Use set_static_spec_shared() to ensure that we don't try and free() the static string "ld", also ensuring that any previously-allocated string in linker_name_spec is freed. Likewise with argv0. (driver::finalize): Use set_static_spec_shared() when resetting specs that previously had allocated strings; remove if(0) around call to free().
[Bug jit/63854] Fix memory leaks seen in JIT
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63854 --- Comment #32 from David Malcolm --- Using: RUN_UNDER_VALGRIND= \ make check-jit \ RUNTESTFLAGS="-v -v -v jit.exp=test-factorial.c" trunk currently shows this: LEAK SUMMARY: definitely lost: 55,908 bytes in 654 blocks indirectly lost: 107,842 bytes in 1,630 blocks possibly lost: 0 bytes in 0 blocks still reachable: 2,075,133 bytes in 686 blocks suppressed: 0 bytes in 0 blocks so there are still some memory leaks.
[Bug jit/63854] Fix memory leaks seen in JIT
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63854 Martin Liška changed: What|Removed |Added CC||marxin at gcc dot gnu.org --- Comment #31 from Martin Liška --- Can the bug be marked as resolved?
[Bug jit/63854] Fix memory leaks seen in JIT
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63854 Bug 63854 depends on bug 64003, which changed state. Bug 64003 Summary: valgrind complains about get_attr_length_nobnd in insn-attrtab.c from i386.md https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64003 What|Removed |Added Status|RESOLVED|REOPENED Resolution|FIXED |---
[Bug jit/63854] Fix memory leaks seen in JIT
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63854 Bug 63854 depends on bug 64003, which changed state. Bug 64003 Summary: valgrind complains about get_attr_length_nobnd in insn-attrtab.c from i386.md https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64003 What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED
[Bug jit/63854] Fix memory leaks seen in JIT
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63854 Bug 63854 depends on bug 64003, which changed state. Bug 64003 Summary: valgrind complains about get_attr_length_nobnd in insn-attrtab.c from i386.md https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64003 What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|--- |FIXED
[Bug jit/63854] Fix memory leaks seen in JIT
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63854 --- Comment #30 from David Malcolm dmalcolm at gcc dot gnu.org --- (In reply to David Binderman from comment #29) Similar thing in the same area, caught using static analyser cppcheck: [gcc/jit/jit-playback.c:1791]: (error) Resource leak: f_in Source code is if (!feof (f_in)) { add_error (NULL, error reading from %s, path); free (result); return NULL; } fclose (f_in); It looks to me like a call to fclose needs to happen just before the return. Thanks. I've fixed this in r219487.
[Bug jit/63854] Fix memory leaks seen in JIT
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63854 David Binderman dcb314 at hotmail dot com changed: What|Removed |Added CC||dcb314 at hotmail dot com --- Comment #29 from David Binderman dcb314 at hotmail dot com --- Similar thing in the same area, caught using static analyser cppcheck: [gcc/jit/jit-playback.c:1791]: (error) Resource leak: f_in Source code is if (!feof (f_in)) { add_error (NULL, error reading from %s, path); free (result); return NULL; } fclose (f_in); It looks to me like a call to fclose needs to happen just before the return.
[Bug jit/63854] Fix memory leaks seen in JIT
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63854 David Malcolm dmalcolm at gcc dot gnu.org changed: What|Removed |Added Severity|normal |major
[Bug jit/63854] Fix memory leaks seen in JIT
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63854 --- Comment #28 from David Malcolm dmalcolm at gcc dot gnu.org --- Author: dmalcolm Date: Tue Dec 9 20:46:33 2014 New Revision: 218538 URL: https://gcc.gnu.org/viewcvs?rev=218538root=gccview=rev Log: PR jit/63854: Document how to run the jit testsuite under valgrind gcc/jit/ChangeLog: PR jit/63854 * docs/internals/index.rst (Running under valgrind): New subsection. (docs/_build/texinfo/libgccjit.texi): Regenerate. Modified: trunk/gcc/jit/ChangeLog trunk/gcc/jit/docs/_build/texinfo/libgccjit.texi trunk/gcc/jit/docs/internals/index.rst
[Bug jit/63854] Fix memory leaks seen in JIT
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63854 --- Comment #27 from David Malcolm dmalcolm at gcc dot gnu.org --- Author: dmalcolm Date: Mon Dec 8 19:31:45 2014 New Revision: 218490 URL: https://gcc.gnu.org/viewcvs?rev=218490root=gccview=rev Log: PR jit/63854: Introduce xstrdup_for_dump gcc/ChangeLog: PR jit/63854 * cgraph.h (xstrdup_for_dump): New function. * cgraph.c (cgraph_node::get_create): Replace use of xstrdup within fprintf with xstrdup_for_dump. (cgraph_edge::make_speculative): Likewise. (cgraph_edge::resolve_speculation): Likewise. (cgraph_edge::redirect_call_stmt_to_callee): Likewise. (cgraph_node::dump): Likewise. * cgraphclones.c (symbol_table::materialize_all_clones): Likewise. * ipa-cp.c (perhaps_add_new_callers): Likewise. * ipa-inline.c (report_inline_failed_reason): Likewise. (want_early_inline_function_p): Likewise. (edge_badness): Likewise. (update_edge_key): Likewise. (flatten_function): Likewise. (inline_always_inline_functions): Likewise. * ipa-profile.c (ipa_profile): Likewise. * ipa-prop.c (ipa_print_node_jump_functions): Likewise. (ipa_make_edge_direct_to_target): Likewise. (remove_described_reference): Likewise. (propagate_controlled_uses): Likewise. * ipa-utils.c (ipa_merge_profiles): Likewise. Modified: trunk/gcc/ChangeLog trunk/gcc/cgraph.c trunk/gcc/cgraph.h trunk/gcc/cgraphclones.c trunk/gcc/ipa-cp.c trunk/gcc/ipa-inline.c trunk/gcc/ipa-profile.c trunk/gcc/ipa-prop.c trunk/gcc/ipa-utils.c
[Bug jit/63854] Fix memory leaks seen in JIT
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63854 --- Comment #25 from David Malcolm dmalcolm at gcc dot gnu.org --- Author: dmalcolm Date: Thu Dec 4 21:11:04 2014 New Revision: 218403 URL: https://gcc.gnu.org/viewcvs?rev=218403root=gccview=rev Log: PR jit/63854: Fix leak of ipa hooks gcc/ChangeLog: PR jit/63854 * ipa-prop.c (ipa_register_cgraph_hooks): Guard insertion of ipa_add_new_function on function_insertion_hook_holder being non-NULL. * ipa-reference.c (ipa_reference_c_finalize): Remove node_removal_hook_holder and node_duplication_hook_holder if they've been added to symtab. * toplev.c (toplev::finalize): Call ipa_reference_c_finalize before cgraph_c_finalize so that the former can access symtab. Modified: trunk/gcc/ChangeLog trunk/gcc/ipa-prop.c trunk/gcc/ipa-reference.c trunk/gcc/toplev.c
[Bug jit/63854] Fix memory leaks seen in JIT
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63854 --- Comment #26 from David Malcolm dmalcolm at gcc dot gnu.org --- Author: dmalcolm Date: Thu Dec 4 21:23:57 2014 New Revision: 218404 URL: https://gcc.gnu.org/viewcvs?rev=218404root=gccview=rev Log: PR jit/63854: Fix double-initialization within tree-pretty-print.c gcc/ChangeLog: PR jit/63854 * tree-pretty-print.c: Eliminate include of new. (buffer): Convert this variable from a pretty_printer to a pretty_printer *. (initialized): Eliminate this variable in favor of the NULL-ness of buffer. (print_generic_decl): Update for buffer becoming a pointer. (print_generic_stmt): Likewise. (print_generic_stmt_indented): Likewise. (print_generic_expr): Likewise. (maybe_init_pretty_print): Likewise, allocating buffer on the heap and using its non-NULL-ness to ensure idempotency. Modified: trunk/gcc/ChangeLog trunk/gcc/tree-pretty-print.c
[Bug jit/63854] Fix memory leaks seen in JIT
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63854 --- Comment #20 from dmalcolm at gcc dot gnu.org --- Author: dmalcolm Date: Mon Dec 1 16:13:29 2014 New Revision: 218227 URL: https://gcc.gnu.org/viewcvs?rev=218227root=gccview=rev Log: PR jit/63854: Add support for running make check-jit under valgrind gcc/testsuite/ChangeLog: PR jit/63854 * jit.dg/jit.exp (report_leak): New. (parse_valgrind_logfile): New. (fixed_host_execute): Detect if RUN_UNDER_VALGRIND is present in the environment, and if so, run the executable under valgrind, capturing valgrind's output to a logfile. Parse the log file, generating PASSes and XFAILs for the summary of leaks. Use wait before close: valgrind might not have finished writing the log out before we parse it, so we need to wait for the spawnee to finish. Modified: trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/jit.dg/jit.exp
[Bug jit/63854] Fix memory leaks seen in JIT
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63854 --- Comment #21 from dmalcolm at gcc dot gnu.org --- Author: dmalcolm Date: Mon Dec 1 17:16:04 2014 New Revision: 218230 URL: https://gcc.gnu.org/viewcvs?rev=218230root=gccview=rev Log: PR jit/63854: Fix leak in tree-ssa-math-opts.c gcc/ChangeLog: PR jit/63854 * tree-ssa-math-opts.c (execute_cse_sincos_1): Fix a missing release of stmts by converting it to an auto_vec. Modified: trunk/gcc/ChangeLog trunk/gcc/tree-ssa-math-opts.c
[Bug jit/63854] Fix memory leaks seen in JIT
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63854 --- Comment #22 from dmalcolm at gcc dot gnu.org --- Author: dmalcolm Date: Mon Dec 1 17:22:19 2014 New Revision: 218231 URL: https://gcc.gnu.org/viewcvs?rev=218231root=gccview=rev Log: PR jit/63854: Fix leak within jit-builtins.c gcc/jit/ChangeLog: PR jit/63854 * jit-builtins.c (gcc::jit::recording::builtins_manager::make_fn_type): Call the context's new_function_type method, rather than directly creating a function_type instance. * jit-recording.c (gcc::jit::recording::context::new_function_type): New method, adapted from part of... (gcc::jit::recording::context::new_function_ptr_type): ...this. Update to call new_function_type. * jit-recording.h (gcc::jit::recording::context::new_function_type): New method. Modified: trunk/gcc/jit/ChangeLog trunk/gcc/jit/jit-builtins.c trunk/gcc/jit/jit-recording.c trunk/gcc/jit/jit-recording.h
[Bug jit/63854] Fix memory leaks seen in JIT
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63854 --- Comment #23 from dmalcolm at gcc dot gnu.org --- Author: dmalcolm Date: Mon Dec 1 17:28:28 2014 New Revision: 218233 URL: https://gcc.gnu.org/viewcvs?rev=218233root=gccview=rev Log: PR jit/63854: Fix leak in real.c for i386:init_ext_80387_constants gcc/ChangeLog: PR jit/63854 * real.c (real_from_string): Add missing mpfr_clear. Modified: trunk/gcc/ChangeLog trunk/gcc/real.c
[Bug jit/63854] Fix memory leaks seen in JIT
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63854 --- Comment #24 from dmalcolm at gcc dot gnu.org --- Author: dmalcolm Date: Mon Dec 1 17:40:03 2014 New Revision: 218234 URL: https://gcc.gnu.org/viewcvs?rev=218234root=gccview=rev Log: PR jit/63854: Fix leaks in toyvm.c gcc/jit/ChangeLog: PR jit/63854 * docs/examples/tut04-toyvm/toyvm.c (toyvm_compiled_function): New typedef. (toyvm_compiled_func) Rename to... (toyvm_compiled_code) ...this. (struct toyvm_compiled_function): New struct. (toyvm_function_compile): Return a toyvm_compiled_function * rather than a toyvm_compiled_func, so that the caller can fully clean things up. Free funcname. (test_script): Update for change to toyvm_function_compile. Clean up the toyvm_compiled_function. (main): Likewise. (docs/intro/tutorial04.rst): Update to reflect the above changes, and to better spell out the lifetime of the compiled code. Modified: trunk/gcc/jit/ChangeLog trunk/gcc/jit/docs/examples/tut04-toyvm/toyvm.c trunk/gcc/jit/docs/intro/tutorial04.rst
[Bug jit/63854] Fix memory leaks seen in JIT
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63854 --- Comment #3 from dmalcolm at gcc dot gnu.org --- Author: dmalcolm Date: Wed Nov 19 19:08:29 2014 New Revision: 217791 URL: https://gcc.gnu.org/viewcvs?rev=217791root=gccview=rev Log: PR jit/63854: Fix memory leak within gcc_options gcc/ChangeLog: PR jit/63854 * opts.c (finalize_options_struct): New. * opts.h (finalize_options_struct): New. * toplev.c (toplev::finalize): Call finalize_options_struct on global_options and global_options_set. Modified: trunk/gcc/ChangeLog trunk/gcc/opts.c trunk/gcc/opts.h trunk/gcc/toplev.c
[Bug jit/63854] Fix memory leaks seen in JIT
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63854 --- Comment #4 from dmalcolm at gcc dot gnu.org --- Author: dmalcolm Date: Wed Nov 19 19:11:37 2014 New Revision: 217792 URL: https://gcc.gnu.org/viewcvs?rev=217792root=gccview=rev Log: PR jit/63854: Fix memory leak of reginfo.c: valid_mode_changes_obstack gcc/ChangeLog: PR jit/63854 * reginfo.c (finish_subregs_of_mode): Replace obstack_finish with obstack_free when cleaning up valid_mode_changes_obstack. Modified: trunk/gcc/ChangeLog trunk/gcc/reginfo.c
[Bug jit/63854] Fix memory leaks seen in JIT
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63854 --- Comment #6 from dmalcolm at gcc dot gnu.org --- Author: dmalcolm Date: Wed Nov 19 19:28:33 2014 New Revision: 217794 URL: https://gcc.gnu.org/viewcvs?rev=217794root=gccview=rev Log: PR jit/63854: Fix memory leak within bb-reorder.c gcc/ChangeLog: PR jit/63854 * bb-reorder.c (find_rarely_executed_basic_blocks_and_crossing_edges): Convert local bbs_in_hot_partition from vec to auto_vec. Modified: trunk/gcc/ChangeLog trunk/gcc/bb-reorder.c
[Bug jit/63854] Fix memory leaks seen in JIT
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63854 --- Comment #5 from dmalcolm at gcc dot gnu.org --- Author: dmalcolm Date: Wed Nov 19 19:23:06 2014 New Revision: 217793 URL: https://gcc.gnu.org/viewcvs?rev=217793root=gccview=rev Log: PR jit/63854: Fix memory leaks within context/pass_manager/dump_manager gcc/ChangeLog: PR jit/63854 * config/alpha/alpha.c (alpha_option_override): Remove static from handle_trap_shadows_info and align_insns_info. * config/i386/i386.c (ix86_option_override): Likewise for insert_vzeroupper_info. * config/rl78/rl78.c (rl78_asm_file_start): Likewise for rl78_devirt_info and rl78_move_elim_info. * config/rs6000/rs6000.c (rs6000_option_override): Likewise for analyze_swaps_info. * context.c (gcc::context::~context): New. * context.h (gcc::context::~context): New. * dumpfile.c (dump_files): Add false initializers for new field owns_strings. (gcc::dump_manager::~dump_manager): New. (gcc::dump_manager::dump_register): Add param take_ownership. * dumpfile.h (struct dump_file_info): Add field owns_strings. (gcc::dump_manager::~dump_manager): New. (gcc::dump_manager::dump_register): Add param take_ownership. * pass_manager.h (gcc::pass_manager::operator delete): New. (gcc::pass_manager::~pass_manager): New. * passes.c (pass_manager::register_one_dump_file): Pass true to new owns_strings argument to dump_register. (pass_manager::operator delete): New. (delete_pass_tree): New function. (pass_manager::~pass_manager): New. * statistics.c (statistics_early_init): Pass false to new owns_strings argument to dump_register. * toplev.c (toplev::finalize): Clean up the context and thus the things it owns. Modified: trunk/gcc/ChangeLog trunk/gcc/config/alpha/alpha.c trunk/gcc/config/i386/i386.c trunk/gcc/config/rl78/rl78.c trunk/gcc/config/rs6000/rs6000.c trunk/gcc/context.c trunk/gcc/context.h trunk/gcc/dumpfile.c trunk/gcc/dumpfile.h trunk/gcc/pass_manager.h trunk/gcc/passes.c trunk/gcc/statistics.c trunk/gcc/toplev.c
[Bug jit/63854] Fix memory leaks seen in JIT
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63854 --- Comment #7 from dmalcolm at gcc dot gnu.org --- Author: dmalcolm Date: Wed Nov 19 19:33:49 2014 New Revision: 217795 URL: https://gcc.gnu.org/viewcvs?rev=217795root=gccview=rev Log: PR jit/63854: Fix memory leak of save_decoded_options gcc/ChangeLog: PR jit/63854 * toplev.c (toplev::finalize): Clean up save_decoded_options. Modified: trunk/gcc/ChangeLog trunk/gcc/toplev.c
[Bug jit/63854] Fix memory leaks seen in JIT
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63854 --- Comment #8 from dmalcolm at gcc dot gnu.org --- Author: dmalcolm Date: Wed Nov 19 19:43:20 2014 New Revision: 217796 URL: https://gcc.gnu.org/viewcvs?rev=217796root=gccview=rev Log: PR jit/63854: Fix leak of opts_obstack gcc/ChangeLog: PR jit/63854 * toplev.c (toplev::finalize): Free opts_obstack. Modified: trunk/gcc/ChangeLog trunk/gcc/toplev.c
[Bug jit/63854] Fix memory leaks seen in JIT
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63854 --- Comment #9 from dmalcolm at gcc dot gnu.org --- Author: dmalcolm Date: Wed Nov 19 19:45:39 2014 New Revision: 217797 URL: https://gcc.gnu.org/viewcvs?rev=217797root=gccview=rev Log: PR jit/63854: Fix leak of optimization_summary_obstack gcc/ChangeLog: PR jit/63854 * ipa-reference.c (ipa_reference_c_finalize): Release optimization_summary_obstack. Modified: trunk/gcc/ChangeLog trunk/gcc/ipa-reference.c
[Bug jit/63854] Fix memory leaks seen in JIT
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63854 --- Comment #10 from dmalcolm at gcc dot gnu.org --- Author: dmalcolm Date: Wed Nov 19 19:49:28 2014 New Revision: 217800 URL: https://gcc.gnu.org/viewcvs?rev=217800root=gccview=rev Log: PR jit/63854: Add ira_costs_c_finalize gcc/ChangeLog: PR jit/63854 * ira-costs.c (ira_costs_c_finalize): New function. * ira.h (ira_costs_c_finalize): New prototype. * toplev.c (toplev::finalize): Call ira_costs_c_finalize. Modified: trunk/gcc/ChangeLog trunk/gcc/ira-costs.c trunk/gcc/ira.h trunk/gcc/toplev.c
[Bug jit/63854] Fix memory leaks seen in JIT
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63854 --- Comment #11 from dmalcolm at gcc dot gnu.org --- Author: dmalcolm Date: Wed Nov 19 19:57:09 2014 New Revision: 217801 URL: https://gcc.gnu.org/viewcvs?rev=217801root=gccview=rev Log: PR jit/63854: Don't leak producer_string in dwarf2out.c gcc/ChangeLog: PR jit/63854 * dwarf2out.c (dwarf2out_c_finalize): Free producer_string. Modified: trunk/gcc/ChangeLog trunk/gcc/dwarf2out.c
[Bug jit/63854] Fix memory leaks seen in JIT
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63854 --- Comment #12 from dmalcolm at gcc dot gnu.org --- Author: dmalcolm Date: Wed Nov 19 20:10:00 2014 New Revision: 217802 URL: https://gcc.gnu.org/viewcvs?rev=217802root=gccview=rev Log: PR jit/63854: Fix leak of worklist within jit-recording.c gcc/jit/ChangeLog: PR jit/63854 * jit-recording.c (recording::function::validate): Convert worklist from vec to autovec to fix a leak. Modified: trunk/gcc/jit/ChangeLog trunk/gcc/jit/jit-recording.c
[Bug jit/63854] Fix memory leaks seen in JIT
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63854 --- Comment #13 from dmalcolm at gcc dot gnu.org --- Author: dmalcolm Date: Wed Nov 19 20:14:18 2014 New Revision: 217803 URL: https://gcc.gnu.org/viewcvs?rev=217803root=gccview=rev Log: PR jit/63854: Fix leak of avail within tree-ssa-pre.c gcc/ChangeLog: PR jit/63854 * tree-ssa-pre.c (do_regular_insertion): Convert avail from vec to auto_vec to fix a leak. Modified: trunk/gcc/ChangeLog trunk/gcc/tree-ssa-pre.c
[Bug jit/63854] Fix memory leaks seen in JIT
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63854 --- Comment #14 from dmalcolm at gcc dot gnu.org --- Author: dmalcolm Date: Wed Nov 19 20:17:44 2014 New Revision: 217804 URL: https://gcc.gnu.org/viewcvs?rev=217804root=gccview=rev Log: PR jit/63854: Fix leak of paths within jump threading gcc/ChangeLog: PR jit/63854 * tree-ssa-threadedge.c (thread_across_edge): Don't just release path, delete it. * tree-ssa-threadupdate.c (delete_jump_thread_path): Likewise. Modified: trunk/gcc/ChangeLog trunk/gcc/tree-ssa-threadedge.c trunk/gcc/tree-ssa-threadupdate.c
[Bug jit/63854] Fix memory leaks seen in JIT
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63854 --- Comment #15 from dmalcolm at gcc dot gnu.org --- Author: dmalcolm Date: Wed Nov 19 20:21:19 2014 New Revision: 217806 URL: https://gcc.gnu.org/viewcvs?rev=217806root=gccview=rev Log: PR jit/63854: lra.c: Fix leak of point_freq_vec's buffer when calling lra_inheritance gcc/ChangeLog: PR jit/63854 * lra.c (lra): After creating live ranges in preparation for call to lra_inheritance, set live_p to true. Modified: trunk/gcc/ChangeLog trunk/gcc/lra.c
[Bug jit/63854] Fix memory leaks seen in JIT
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63854 --- Comment #16 from dmalcolm at gcc dot gnu.org --- Author: dmalcolm Date: Wed Nov 19 20:26:57 2014 New Revision: 217807 URL: https://gcc.gnu.org/viewcvs?rev=217807root=gccview=rev Log: PR jit/63854: Add all_late_ipa_passes to GCC_PASS_LISTS gcc/ChangeLog: PR jit/63854 * pass_manager.h (GCC_PASS_LISTS): Add all_late_ipa_passes. Modified: trunk/gcc/ChangeLog trunk/gcc/pass_manager.h
[Bug jit/63854] Fix memory leaks seen in JIT
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63854 --- Comment #17 from dmalcolm at gcc dot gnu.org --- Author: dmalcolm Date: Wed Nov 19 20:31:52 2014 New Revision: 217808 URL: https://gcc.gnu.org/viewcvs?rev=217808root=gccview=rev Log: PR jit/63854: Fix leaking vec in jit gcc/jit/ChangeLog: PR jit/63854 * jit-playback.c (gcc::jit::playback::compound_type::set_fields): Convert param from const vecplayback::field * to const auto_vecplayback::field * *. (gcc::jit::playback::context::new_function_type): Convert param param_types from vectype * * to const auto_vectype * *. (gcc::jit::playback::context::new_function): Convert param params from vecparam * * to const auto_vecparam * *. (gcc::jit::playback::context::build_call): Convert param args from vecrvalue * to const auto_vecrvalue * *. (gcc::jit::playback::context::new_call): Likewise. (gcc::jit::playback::context::new_call_through_ptr): Likewise. (wrapper_finalizer): New function. (gcc::jit::playback::wrapper::operator new): Call the finalizer variant of ggc_internal_cleared_alloc, supplying wrapper_finalizer. (gcc::jit::playback::function::finalizer): New. (gcc::jit::playback::block::finalizer): New. (gcc::jit::playback::source_file::finalizer): New. (gcc::jit::playback::source_line::finalizer): New. * jit-playback.h (gcc::jit::playback::context::new_function_type): Convert param param_types from vectype * * to const auto_vectype * *. (gcc::jit::playback::context::new_function): Convert param params from vecparam * * to const auto_vecparam * *. (gcc::jit::playback::context::new_call): Convert param args from vecrvalue * to const auto_vecrvalue * *. (gcc::jit::playback::context::new_call_through_ptr): Likewise. (gcc::jit::playback::context::build_call): Likewise. (gcc::jit::playback::context): Convert fields m_functions, m_source_files, m_cached_locations from vec to auto_vec. (gcc::jit::playback::wrapper::finalizer): New virtual function. (gcc::jit::playback::compound_type::set_fields): Convert param fro const vecplayback::field * to const auto_vecplayback::field * *. (gcc::jit::playback::function::finalizer): New. (gcc::jit::playback::block::finalizer): New. (gcc::jit::playback::source_file::finalizer): New. (gcc::jit::playback::source_line::finalizer): New. * jit-recording.c (gcc::jit::recording::function_type::replay_into): Convert local from a vec into an auto_vec. (gcc::jit::recording::fields::replay_into): Likewise. (gcc::jit::recording::function::replay_into): Likewise. (gcc::jit::recording::call::replay_into): Likewise. (gcc::jit::recording::call_through_ptr::replay_into): Likewise. * jit-recording.h (gcc::jit::recording::context): Convert fields m_mementos, m_compound_types, m_functions from vec to auto_vec . (gcc::jit::recording::function_type::get_param_types): Convert return type from vectype * to const vectype * . (gcc::jit::recording::function_type): Convert field m_param_types from a vec to an auto_vec. (gcc::jit::recording::fields): Likewise for field m_fields. (gcc::jit::recording::function::get_params): Convert return type from vec param * to const vecparam * . (gcc::jit::recording::function): Convert fields m_params, m_locals, m_blocks from vec to auto_vec. (gcc::jit::recording::block): Likewise for field m_statements. vec to auto_vec. (gcc::jit::recording::call): Likewise for field m_args. (gcc::jit::recording::call_through_ptr): Likewise. Modified: trunk/gcc/jit/ChangeLog trunk/gcc/jit/jit-playback.c trunk/gcc/jit/jit-playback.h trunk/gcc/jit/jit-recording.c trunk/gcc/jit/jit-recording.h
[Bug jit/63854] Fix memory leaks seen in JIT
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63854 --- Comment #18 from dmalcolm at gcc dot gnu.org --- Author: dmalcolm Date: Wed Nov 19 20:42:29 2014 New Revision: 217811 URL: https://gcc.gnu.org/viewcvs?rev=217811root=gccview=rev Log: PR jit/63854: Fix leak in ipa-icf.c gcc/ChangeLog: PR jit/63854 * ipa-icf.c (sem_item_optimizer::~sem_item_optimizer): Free each congruence_class_group *. Modified: trunk/gcc/ChangeLog trunk/gcc/ipa-icf.c
[Bug jit/63854] Fix memory leaks seen in JIT
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63854 --- Comment #19 from dmalcolm at gcc dot gnu.org --- Author: dmalcolm Date: Wed Nov 19 20:45:03 2014 New Revision: 217812 URL: https://gcc.gnu.org/viewcvs?rev=217812root=gccview=rev Log: PR jit/63854: Fix leaks in test-fuzzer.c gcc/testsuite/ChangeLog: PR jit/63854 * jit.dg/test-fuzzer.c (fuzzer_init): Free malloced buffers. (make_random_function): Free ff-locals. Modified: trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/jit.dg/test-fuzzer.c
[Bug jit/63854] Fix memory leaks seen in JIT
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63854 dmalcolm at gcc dot gnu.org changed: What|Removed |Added Status|UNCONFIRMED |ASSIGNED Last reconfirmed||2014-11-17 Ever confirmed|0 |1 --- Comment #2 from dmalcolm at gcc dot gnu.org --- FWIW am actively working on this; in my current working copy I have the leaks down to: definitely lost: 1,916 bytes in 80 blocks indirectly lost: 352 bytes in 4 blocks
[Bug jit/63854] Fix memory leaks seen in JIT
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63854 --- Comment #1 from dmalcolm at gcc dot gnu.org --- Note to self: this was with r217427.