This is the mail archive of the gcc-bugs@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]

Re: cc1 memory leaks


> Let me know if this is useful, or if you want me to try something else.

I'd typically use a much deeper stack, like 12 or so.

>   * This memory was allocated from:
> 	malloc         [rtlib.o]
> 	xmalloc        [xmalloc.c:72]
> 	create_edge_list [flow.c:6428]
> 	schedule_insns [haifa-sched.c:6903]
> 	rest_of_compilation [toplev.c:3232]
> 	finish_function [c-decl.c:6499]

It seems that the edge list created in schedule_insns insns is not
deallocated. From a shallow inspection, it appears that it is safe
to call free_edge_list right before

	  /* For now.  This will move as more and more of haifa is converted
	     to using the cfg code in flow.c.  */
	  free (dom);

I don't know this code at all; could you please try whether changing
it that way
a) makes the leak go away, and
b) still does not break the compiler (i.e. the testsuite still passes)?

> MLK: 320 bytes leaked in 4 blocks
>   * This memory was allocated from:
> 	malloc         [rtlib.o]
> 	xmalloc        [xmalloc.c:72]
> 	push_string    [c-typeck.c:4395]
> 	start_init     [c-typeck.c:4940]
> 	yyparse        [c-parse.y:994]
> 	compile_file   [toplev.c:2262]
>   * Block of 80 bytes (4 times); last block at 0x78e248

It seems that this leak is "by design": the stack is initially
created, and slots get reused as the stack shrinks and grows. The
final contents of the stack is not freed.

Regards,
Martin

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