This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

more malloc mitigation


Hi,

2012-08-18 Dimitrios Apostolou <jimis@gmx.net>

	* gcc/tree-ssa-sccvn.c (struct vn_tables_s): Add obstack_start to
	mark the first allocated object on the obstack.
	(process_scc, allocate_vn_table): Use it.
	(init_scc_vn): Don't truncate shared_lookup_references vector.
	(prealloc_ref_ops_vec): New static vector.
	(create_reference_ops_from_ref, create_reference_ops_from_call):
	Use it instead of locally allocated one.
	(free_scc_vn): Truncate vectors to 0, but keep them most 16 slots
	long.


I'd have used a stack vector for create_reference_ops_from_{ref,call} instead of a static one on the heap, but the functions return heap vectors. Can I just cast a stack vector to a heap one?


Also is it acceptable to leak 4K because of never freeing the whole obstack?

Tested on x86 with old snapshot, will post update soon after testing with more recent one.


Thanks, Dimitris

Attachment: sccvn.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]