public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug jit/63854] New: Fix memory leaks seen in JIT
@ 2014-11-13 17:58 dmalcolm at gcc dot gnu.org
2014-11-13 18:00 ` [Bug jit/63854] " dmalcolm at gcc dot gnu.org
` (30 more replies)
0 siblings, 31 replies; 32+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2014-11-13 17:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63854
Bug ID: 63854
Summary: Fix memory leaks seen in JIT
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: jit
Assignee: dmalcolm at gcc dot gnu.org
Reporter: dmalcolm at gcc dot gnu.org
Created attachment 33959
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33959&action=edit
Log from valgrind
I'm attaching a log from valgrind on test-factorial.c, running 5 in-process
iterations.
PATH=.:$PATH \
LD_LIBRARY_PATH=. \
LIBRARY_PATH=. \
valgrind \
--leak-check=full \
testsuite/jit/test-factorial.exe 2>&1 | tee test-factorial.valgrind.log
Summary is:
==57820== LEAK SUMMARY:
==57820== definitely lost: 84,140 bytes in 578 blocks
==57820== indirectly lost: 257,864 bytes in 3,185 blocks
==57820== possibly lost: 0 bytes in 0 blocks
==57820== still reachable: 572,159 bytes in 3,112 blocks
==57820== suppressed: 0 bytes in 0 blocks
Various things show up as leaking 4 or 5 times; presumably those are
per-invocation leaks that we ought to fix to avoid them affecting jit users.
^ permalink raw reply [flat|nested] 32+ messages in thread
* [Bug jit/63854] Fix memory leaks seen in JIT
2014-11-13 17:58 [Bug jit/63854] New: Fix memory leaks seen in JIT dmalcolm at gcc dot gnu.org
@ 2014-11-13 18:00 ` dmalcolm at gcc dot gnu.org
2014-11-17 17:49 ` dmalcolm at gcc dot gnu.org
` (29 subsequent siblings)
30 siblings, 0 replies; 32+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2014-11-13 18:00 UTC (permalink / raw)
To: gcc-bugs
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.
^ permalink raw reply [flat|nested] 32+ messages in thread
* [Bug jit/63854] Fix memory leaks seen in JIT
2014-11-13 17:58 [Bug jit/63854] New: Fix memory leaks seen in JIT dmalcolm at gcc dot gnu.org
2014-11-13 18:00 ` [Bug jit/63854] " dmalcolm at gcc dot gnu.org
@ 2014-11-17 17:49 ` dmalcolm at gcc dot gnu.org
2014-11-19 19:09 ` dmalcolm at gcc dot gnu.org
` (28 subsequent siblings)
30 siblings, 0 replies; 32+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2014-11-17 17:49 UTC (permalink / raw)
To: gcc-bugs
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
^ permalink raw reply [flat|nested] 32+ messages in thread
* [Bug jit/63854] Fix memory leaks seen in JIT
2014-11-13 17:58 [Bug jit/63854] New: Fix memory leaks seen in JIT dmalcolm at gcc dot gnu.org
2014-11-13 18:00 ` [Bug jit/63854] " dmalcolm at gcc dot gnu.org
2014-11-17 17:49 ` dmalcolm at gcc dot gnu.org
@ 2014-11-19 19:09 ` dmalcolm at gcc dot gnu.org
2014-11-19 19:12 ` dmalcolm at gcc dot gnu.org
` (27 subsequent siblings)
30 siblings, 0 replies; 32+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2014-11-19 19:09 UTC (permalink / raw)
To: gcc-bugs
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=217791&root=gcc&view=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
^ permalink raw reply [flat|nested] 32+ messages in thread
* [Bug jit/63854] Fix memory leaks seen in JIT
2014-11-13 17:58 [Bug jit/63854] New: Fix memory leaks seen in JIT dmalcolm at gcc dot gnu.org
` (2 preceding siblings ...)
2014-11-19 19:09 ` dmalcolm at gcc dot gnu.org
@ 2014-11-19 19:12 ` dmalcolm at gcc dot gnu.org
2014-11-19 19:23 ` dmalcolm at gcc dot gnu.org
` (26 subsequent siblings)
30 siblings, 0 replies; 32+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2014-11-19 19:12 UTC (permalink / raw)
To: gcc-bugs
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=217792&root=gcc&view=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
^ permalink raw reply [flat|nested] 32+ messages in thread
* [Bug jit/63854] Fix memory leaks seen in JIT
2014-11-13 17:58 [Bug jit/63854] New: Fix memory leaks seen in JIT dmalcolm at gcc dot gnu.org
` (3 preceding siblings ...)
2014-11-19 19:12 ` dmalcolm at gcc dot gnu.org
@ 2014-11-19 19:23 ` dmalcolm at gcc dot gnu.org
2014-11-19 19:34 ` dmalcolm at gcc dot gnu.org
` (25 subsequent siblings)
30 siblings, 0 replies; 32+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2014-11-19 19:23 UTC (permalink / raw)
To: gcc-bugs
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=217793&root=gcc&view=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
^ permalink raw reply [flat|nested] 32+ messages in thread
* [Bug jit/63854] Fix memory leaks seen in JIT
2014-11-13 17:58 [Bug jit/63854] New: Fix memory leaks seen in JIT dmalcolm at gcc dot gnu.org
` (4 preceding siblings ...)
2014-11-19 19:23 ` dmalcolm at gcc dot gnu.org
@ 2014-11-19 19:34 ` dmalcolm at gcc dot gnu.org
2014-11-19 19:43 ` dmalcolm at gcc dot gnu.org
` (24 subsequent siblings)
30 siblings, 0 replies; 32+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2014-11-19 19:34 UTC (permalink / raw)
To: gcc-bugs
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=217795&root=gcc&view=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
^ permalink raw reply [flat|nested] 32+ messages in thread
* [Bug jit/63854] Fix memory leaks seen in JIT
2014-11-13 17:58 [Bug jit/63854] New: Fix memory leaks seen in JIT dmalcolm at gcc dot gnu.org
` (5 preceding siblings ...)
2014-11-19 19:34 ` dmalcolm at gcc dot gnu.org
@ 2014-11-19 19:43 ` dmalcolm at gcc dot gnu.org
2014-11-19 19:46 ` dmalcolm at gcc dot gnu.org
` (23 subsequent siblings)
30 siblings, 0 replies; 32+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2014-11-19 19:43 UTC (permalink / raw)
To: gcc-bugs
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=217796&root=gcc&view=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
^ permalink raw reply [flat|nested] 32+ messages in thread
* [Bug jit/63854] Fix memory leaks seen in JIT
2014-11-13 17:58 [Bug jit/63854] New: Fix memory leaks seen in JIT dmalcolm at gcc dot gnu.org
` (6 preceding siblings ...)
2014-11-19 19:43 ` dmalcolm at gcc dot gnu.org
@ 2014-11-19 19:46 ` dmalcolm at gcc dot gnu.org
2014-11-19 19:50 ` dmalcolm at gcc dot gnu.org
` (22 subsequent siblings)
30 siblings, 0 replies; 32+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2014-11-19 19:46 UTC (permalink / raw)
To: gcc-bugs
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=217797&root=gcc&view=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
^ permalink raw reply [flat|nested] 32+ messages in thread
* [Bug jit/63854] Fix memory leaks seen in JIT
2014-11-13 17:58 [Bug jit/63854] New: Fix memory leaks seen in JIT dmalcolm at gcc dot gnu.org
` (7 preceding siblings ...)
2014-11-19 19:46 ` dmalcolm at gcc dot gnu.org
@ 2014-11-19 19:50 ` dmalcolm at gcc dot gnu.org
2014-11-19 19:57 ` dmalcolm at gcc dot gnu.org
` (21 subsequent siblings)
30 siblings, 0 replies; 32+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2014-11-19 19:50 UTC (permalink / raw)
To: gcc-bugs
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=217800&root=gcc&view=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
^ permalink raw reply [flat|nested] 32+ messages in thread
* [Bug jit/63854] Fix memory leaks seen in JIT
2014-11-13 17:58 [Bug jit/63854] New: Fix memory leaks seen in JIT dmalcolm at gcc dot gnu.org
` (8 preceding siblings ...)
2014-11-19 19:50 ` dmalcolm at gcc dot gnu.org
@ 2014-11-19 19:57 ` dmalcolm at gcc dot gnu.org
2014-11-19 20:10 ` dmalcolm at gcc dot gnu.org
` (20 subsequent siblings)
30 siblings, 0 replies; 32+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2014-11-19 19:57 UTC (permalink / raw)
To: gcc-bugs
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=217801&root=gcc&view=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
^ permalink raw reply [flat|nested] 32+ messages in thread
* [Bug jit/63854] Fix memory leaks seen in JIT
2014-11-13 17:58 [Bug jit/63854] New: Fix memory leaks seen in JIT dmalcolm at gcc dot gnu.org
` (9 preceding siblings ...)
2014-11-19 19:57 ` dmalcolm at gcc dot gnu.org
@ 2014-11-19 20:10 ` dmalcolm at gcc dot gnu.org
2014-11-19 20:14 ` dmalcolm at gcc dot gnu.org
` (19 subsequent siblings)
30 siblings, 0 replies; 32+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2014-11-19 20:10 UTC (permalink / raw)
To: gcc-bugs
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=217802&root=gcc&view=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
^ permalink raw reply [flat|nested] 32+ messages in thread
* [Bug jit/63854] Fix memory leaks seen in JIT
2014-11-13 17:58 [Bug jit/63854] New: Fix memory leaks seen in JIT dmalcolm at gcc dot gnu.org
` (10 preceding siblings ...)
2014-11-19 20:10 ` dmalcolm at gcc dot gnu.org
@ 2014-11-19 20:14 ` dmalcolm at gcc dot gnu.org
2014-11-19 20:18 ` dmalcolm at gcc dot gnu.org
` (18 subsequent siblings)
30 siblings, 0 replies; 32+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2014-11-19 20:14 UTC (permalink / raw)
To: gcc-bugs
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=217803&root=gcc&view=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
^ permalink raw reply [flat|nested] 32+ messages in thread
* [Bug jit/63854] Fix memory leaks seen in JIT
2014-11-13 17:58 [Bug jit/63854] New: Fix memory leaks seen in JIT dmalcolm at gcc dot gnu.org
` (11 preceding siblings ...)
2014-11-19 20:14 ` dmalcolm at gcc dot gnu.org
@ 2014-11-19 20:18 ` dmalcolm at gcc dot gnu.org
2014-11-19 20:21 ` dmalcolm at gcc dot gnu.org
` (17 subsequent siblings)
30 siblings, 0 replies; 32+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2014-11-19 20:18 UTC (permalink / raw)
To: gcc-bugs
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=217804&root=gcc&view=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
^ permalink raw reply [flat|nested] 32+ messages in thread
* [Bug jit/63854] Fix memory leaks seen in JIT
2014-11-13 17:58 [Bug jit/63854] New: Fix memory leaks seen in JIT dmalcolm at gcc dot gnu.org
` (12 preceding siblings ...)
2014-11-19 20:18 ` dmalcolm at gcc dot gnu.org
@ 2014-11-19 20:21 ` dmalcolm at gcc dot gnu.org
2014-11-19 20:27 ` dmalcolm at gcc dot gnu.org
` (16 subsequent siblings)
30 siblings, 0 replies; 32+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2014-11-19 20:21 UTC (permalink / raw)
To: gcc-bugs
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=217806&root=gcc&view=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
^ permalink raw reply [flat|nested] 32+ messages in thread
* [Bug jit/63854] Fix memory leaks seen in JIT
2014-11-13 17:58 [Bug jit/63854] New: Fix memory leaks seen in JIT dmalcolm at gcc dot gnu.org
` (13 preceding siblings ...)
2014-11-19 20:21 ` dmalcolm at gcc dot gnu.org
@ 2014-11-19 20:27 ` dmalcolm at gcc dot gnu.org
2014-11-19 20:32 ` dmalcolm at gcc dot gnu.org
` (15 subsequent siblings)
30 siblings, 0 replies; 32+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2014-11-19 20:27 UTC (permalink / raw)
To: gcc-bugs
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=217807&root=gcc&view=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
^ permalink raw reply [flat|nested] 32+ messages in thread
* [Bug jit/63854] Fix memory leaks seen in JIT
2014-11-13 17:58 [Bug jit/63854] New: Fix memory leaks seen in JIT dmalcolm at gcc dot gnu.org
` (14 preceding siblings ...)
2014-11-19 20:27 ` dmalcolm at gcc dot gnu.org
@ 2014-11-19 20:32 ` dmalcolm at gcc dot gnu.org
2014-11-19 20:43 ` dmalcolm at gcc dot gnu.org
` (14 subsequent siblings)
30 siblings, 0 replies; 32+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2014-11-19 20:32 UTC (permalink / raw)
To: gcc-bugs
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=217808&root=gcc&view=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 vec<playback::field *> & to
const auto_vec<playback::field *> *.
(gcc::jit::playback::context::new_function_type): Convert param
"param_types" from vec<type *> * to const auto_vec<type *> *.
(gcc::jit::playback::context::new_function): Convert param
"params" from vec<param *> * to const auto_vec<param *> *.
(gcc::jit::playback::context::build_call): Convert param "args"
from vec<rvalue *> to const auto_vec<rvalue *> *.
(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 vec<type *> * to const auto_vec<type *> *.
(gcc::jit::playback::context::new_function): Convert param
"params" from vec<param *> * to const auto_vec<param *> *.
(gcc::jit::playback::context::new_call): Convert param
"args" from vec<rvalue *> to const auto_vec<rvalue *> *.
(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 vec<playback::field *> & to
const auto_vec<playback::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 vec<type *> to const vec<type *> &.
(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 vec<param *> &.
(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
^ permalink raw reply [flat|nested] 32+ messages in thread
* [Bug jit/63854] Fix memory leaks seen in JIT
2014-11-13 17:58 [Bug jit/63854] New: Fix memory leaks seen in JIT dmalcolm at gcc dot gnu.org
` (15 preceding siblings ...)
2014-11-19 20:32 ` dmalcolm at gcc dot gnu.org
@ 2014-11-19 20:43 ` dmalcolm at gcc dot gnu.org
2014-11-19 20:45 ` dmalcolm at gcc dot gnu.org
` (13 subsequent siblings)
30 siblings, 0 replies; 32+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2014-11-19 20:43 UTC (permalink / raw)
To: gcc-bugs
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=217811&root=gcc&view=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
^ permalink raw reply [flat|nested] 32+ messages in thread
* [Bug jit/63854] Fix memory leaks seen in JIT
2014-11-13 17:58 [Bug jit/63854] New: Fix memory leaks seen in JIT dmalcolm at gcc dot gnu.org
` (16 preceding siblings ...)
2014-11-19 20:43 ` dmalcolm at gcc dot gnu.org
@ 2014-11-19 20:45 ` dmalcolm at gcc dot gnu.org
2014-12-01 16:14 ` dmalcolm at gcc dot gnu.org
` (12 subsequent siblings)
30 siblings, 0 replies; 32+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2014-11-19 20:45 UTC (permalink / raw)
To: gcc-bugs
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=217812&root=gcc&view=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
^ permalink raw reply [flat|nested] 32+ messages in thread
* [Bug jit/63854] Fix memory leaks seen in JIT
2014-11-13 17:58 [Bug jit/63854] New: Fix memory leaks seen in JIT dmalcolm at gcc dot gnu.org
` (17 preceding siblings ...)
2014-11-19 20:45 ` dmalcolm at gcc dot gnu.org
@ 2014-12-01 16:14 ` dmalcolm at gcc dot gnu.org
2014-12-01 17:16 ` dmalcolm at gcc dot gnu.org
` (11 subsequent siblings)
30 siblings, 0 replies; 32+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2014-12-01 16:14 UTC (permalink / raw)
To: gcc-bugs
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=218227&root=gcc&view=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
^ permalink raw reply [flat|nested] 32+ messages in thread
* [Bug jit/63854] Fix memory leaks seen in JIT
2014-11-13 17:58 [Bug jit/63854] New: Fix memory leaks seen in JIT dmalcolm at gcc dot gnu.org
` (18 preceding siblings ...)
2014-12-01 16:14 ` dmalcolm at gcc dot gnu.org
@ 2014-12-01 17:16 ` dmalcolm at gcc dot gnu.org
2014-12-01 17:29 ` dmalcolm at gcc dot gnu.org
` (10 subsequent siblings)
30 siblings, 0 replies; 32+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2014-12-01 17:16 UTC (permalink / raw)
To: gcc-bugs
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=218230&root=gcc&view=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
^ permalink raw reply [flat|nested] 32+ messages in thread
* [Bug jit/63854] Fix memory leaks seen in JIT
2014-11-13 17:58 [Bug jit/63854] New: Fix memory leaks seen in JIT dmalcolm at gcc dot gnu.org
` (19 preceding siblings ...)
2014-12-01 17:16 ` dmalcolm at gcc dot gnu.org
@ 2014-12-01 17:29 ` dmalcolm at gcc dot gnu.org
2014-12-01 17:40 ` dmalcolm at gcc dot gnu.org
` (9 subsequent siblings)
30 siblings, 0 replies; 32+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2014-12-01 17:29 UTC (permalink / raw)
To: gcc-bugs
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=218233&root=gcc&view=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
^ permalink raw reply [flat|nested] 32+ messages in thread
* [Bug jit/63854] Fix memory leaks seen in JIT
2014-11-13 17:58 [Bug jit/63854] New: Fix memory leaks seen in JIT dmalcolm at gcc dot gnu.org
` (20 preceding siblings ...)
2014-12-01 17:29 ` dmalcolm at gcc dot gnu.org
@ 2014-12-01 17:40 ` dmalcolm at gcc dot gnu.org
2014-12-04 21:11 ` dmalcolm at gcc dot gnu.org
` (8 subsequent siblings)
30 siblings, 0 replies; 32+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2014-12-01 17:40 UTC (permalink / raw)
To: gcc-bugs
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=218234&root=gcc&view=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
^ permalink raw reply [flat|nested] 32+ messages in thread
* [Bug jit/63854] Fix memory leaks seen in JIT
2014-11-13 17:58 [Bug jit/63854] New: Fix memory leaks seen in JIT dmalcolm at gcc dot gnu.org
` (21 preceding siblings ...)
2014-12-01 17:40 ` dmalcolm at gcc dot gnu.org
@ 2014-12-04 21:11 ` dmalcolm at gcc dot gnu.org
2014-12-04 21:24 ` dmalcolm at gcc dot gnu.org
` (7 subsequent siblings)
30 siblings, 0 replies; 32+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2014-12-04 21:11 UTC (permalink / raw)
To: gcc-bugs
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=218403&root=gcc&view=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
^ permalink raw reply [flat|nested] 32+ messages in thread
* [Bug jit/63854] Fix memory leaks seen in JIT
2014-11-13 17:58 [Bug jit/63854] New: Fix memory leaks seen in JIT dmalcolm at gcc dot gnu.org
` (22 preceding siblings ...)
2014-12-04 21:11 ` dmalcolm at gcc dot gnu.org
@ 2014-12-04 21:24 ` dmalcolm at gcc dot gnu.org
2014-12-09 20:47 ` dmalcolm at gcc dot gnu.org
` (6 subsequent siblings)
30 siblings, 0 replies; 32+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2014-12-04 21:24 UTC (permalink / raw)
To: gcc-bugs
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=218404&root=gcc&view=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
^ permalink raw reply [flat|nested] 32+ messages in thread
* [Bug jit/63854] Fix memory leaks seen in JIT
2014-11-13 17:58 [Bug jit/63854] New: Fix memory leaks seen in JIT dmalcolm at gcc dot gnu.org
` (23 preceding siblings ...)
2014-12-04 21:24 ` dmalcolm at gcc dot gnu.org
@ 2014-12-09 20:47 ` dmalcolm at gcc dot gnu.org
2014-12-10 19:16 ` dmalcolm at gcc dot gnu.org
` (5 subsequent siblings)
30 siblings, 0 replies; 32+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2014-12-09 20:47 UTC (permalink / raw)
To: gcc-bugs
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=218538&root=gcc&view=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
^ permalink raw reply [flat|nested] 32+ messages in thread
* [Bug jit/63854] Fix memory leaks seen in JIT
2014-11-13 17:58 [Bug jit/63854] New: Fix memory leaks seen in JIT dmalcolm at gcc dot gnu.org
` (24 preceding siblings ...)
2014-12-09 20:47 ` dmalcolm at gcc dot gnu.org
@ 2014-12-10 19:16 ` dmalcolm at gcc dot gnu.org
2014-12-11 15:07 ` dcb314 at hotmail dot com
` (4 subsequent siblings)
30 siblings, 0 replies; 32+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2014-12-10 19:16 UTC (permalink / raw)
To: gcc-bugs
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
^ permalink raw reply [flat|nested] 32+ messages in thread
* [Bug jit/63854] Fix memory leaks seen in JIT
2014-11-13 17:58 [Bug jit/63854] New: Fix memory leaks seen in JIT dmalcolm at gcc dot gnu.org
` (25 preceding siblings ...)
2014-12-10 19:16 ` dmalcolm at gcc dot gnu.org
@ 2014-12-11 15:07 ` dcb314 at hotmail dot com
2015-01-12 19:59 ` dmalcolm at gcc dot gnu.org
` (3 subsequent siblings)
30 siblings, 0 replies; 32+ messages in thread
From: dcb314 at hotmail dot com @ 2014-12-11 15:07 UTC (permalink / raw)
To: gcc-bugs
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.
^ permalink raw reply [flat|nested] 32+ messages in thread
* [Bug jit/63854] Fix memory leaks seen in JIT
2014-11-13 17:58 [Bug jit/63854] New: Fix memory leaks seen in JIT dmalcolm at gcc dot gnu.org
` (26 preceding siblings ...)
2014-12-11 15:07 ` dcb314 at hotmail dot com
@ 2015-01-12 19:59 ` dmalcolm at gcc dot gnu.org
2015-04-16 14:08 ` ienkovich at gcc dot gnu.org
` (2 subsequent siblings)
30 siblings, 0 replies; 32+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2015-01-12 19:59 UTC (permalink / raw)
To: gcc-bugs
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.
^ permalink raw reply [flat|nested] 32+ messages in thread
* [Bug jit/63854] Fix memory leaks seen in JIT
2014-11-13 17:58 [Bug jit/63854] New: Fix memory leaks seen in JIT dmalcolm at gcc dot gnu.org
` (27 preceding siblings ...)
2015-01-12 19:59 ` dmalcolm at gcc dot gnu.org
@ 2015-04-16 14:08 ` ienkovich at gcc dot gnu.org
2020-08-21 13:26 ` cvs-commit at gcc dot gnu.org
2022-03-19 17:43 ` cvs-commit at gcc dot gnu.org
30 siblings, 0 replies; 32+ messages in thread
From: ienkovich at gcc dot gnu.org @ 2015-04-16 14:08 UTC (permalink / raw)
To: gcc-bugs
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
^ permalink raw reply [flat|nested] 32+ messages in thread
* [Bug jit/63854] Fix memory leaks seen in JIT
2014-11-13 17:58 [Bug jit/63854] New: Fix memory leaks seen in JIT dmalcolm at gcc dot gnu.org
` (28 preceding siblings ...)
2015-04-16 14:08 ` ienkovich at gcc dot gnu.org
@ 2020-08-21 13:26 ` cvs-commit at gcc dot gnu.org
2022-03-19 17:43 ` cvs-commit at gcc dot gnu.org
30 siblings, 0 replies; 32+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-08-21 13:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63854
--- Comment #33 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Alex Coplan <acoplan@gcc.gnu.org>:
https://gcc.gnu.org/g:b46584d7836bee011facdf946fd7241c748d66f0
commit r11-2799-gb46584d7836bee011facdf946fd7241c748d66f0
Author: Alex Coplan <alex.coplan@arm.com>
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().
^ permalink raw reply [flat|nested] 32+ messages in thread
* [Bug jit/63854] Fix memory leaks seen in JIT
2014-11-13 17:58 [Bug jit/63854] New: Fix memory leaks seen in JIT dmalcolm at gcc dot gnu.org
` (29 preceding siblings ...)
2020-08-21 13:26 ` cvs-commit at gcc dot gnu.org
@ 2022-03-19 17:43 ` cvs-commit at gcc dot gnu.org
30 siblings, 0 replies; 32+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-03-19 17:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63854
--- Comment #34 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jeff Law <law@gcc.gnu.org>:
https://gcc.gnu.org/g:bc84b61b00792ef38e1c2cd6b7280087e4fd2b57
commit r12-7723-gbc84b61b00792ef38e1c2cd6b7280087e4fd2b57
Author: Marc Nieper-Wißkirchen <marc@nieper-wisskirchen.de>
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.
^ permalink raw reply [flat|nested] 32+ messages in thread
end of thread, other threads:[~2022-03-19 17:43 UTC | newest]
Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-13 17:58 [Bug jit/63854] New: Fix memory leaks seen in JIT dmalcolm at gcc dot gnu.org
2014-11-13 18:00 ` [Bug jit/63854] " dmalcolm at gcc dot gnu.org
2014-11-17 17:49 ` dmalcolm at gcc dot gnu.org
2014-11-19 19:09 ` dmalcolm at gcc dot gnu.org
2014-11-19 19:12 ` dmalcolm at gcc dot gnu.org
2014-11-19 19:23 ` dmalcolm at gcc dot gnu.org
2014-11-19 19:34 ` dmalcolm at gcc dot gnu.org
2014-11-19 19:43 ` dmalcolm at gcc dot gnu.org
2014-11-19 19:46 ` dmalcolm at gcc dot gnu.org
2014-11-19 19:50 ` dmalcolm at gcc dot gnu.org
2014-11-19 19:57 ` dmalcolm at gcc dot gnu.org
2014-11-19 20:10 ` dmalcolm at gcc dot gnu.org
2014-11-19 20:14 ` dmalcolm at gcc dot gnu.org
2014-11-19 20:18 ` dmalcolm at gcc dot gnu.org
2014-11-19 20:21 ` dmalcolm at gcc dot gnu.org
2014-11-19 20:27 ` dmalcolm at gcc dot gnu.org
2014-11-19 20:32 ` dmalcolm at gcc dot gnu.org
2014-11-19 20:43 ` dmalcolm at gcc dot gnu.org
2014-11-19 20:45 ` dmalcolm at gcc dot gnu.org
2014-12-01 16:14 ` dmalcolm at gcc dot gnu.org
2014-12-01 17:16 ` dmalcolm at gcc dot gnu.org
2014-12-01 17:29 ` dmalcolm at gcc dot gnu.org
2014-12-01 17:40 ` dmalcolm at gcc dot gnu.org
2014-12-04 21:11 ` dmalcolm at gcc dot gnu.org
2014-12-04 21:24 ` dmalcolm at gcc dot gnu.org
2014-12-09 20:47 ` dmalcolm at gcc dot gnu.org
2014-12-10 19:16 ` dmalcolm at gcc dot gnu.org
2014-12-11 15:07 ` dcb314 at hotmail dot com
2015-01-12 19:59 ` dmalcolm at gcc dot gnu.org
2015-04-16 14:08 ` ienkovich at gcc dot gnu.org
2020-08-21 13:26 ` cvs-commit at gcc dot gnu.org
2022-03-19 17:43 ` cvs-commit at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).