This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] Why xstrdup cgraph node names for dumpfiles?
- From: Steven Bosscher <stevenb dot gcc at gmail dot com>
- To: Uros Bizjak <ubizjak at gmail dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, Martin Jambor <mjambor at suse dot cz>, Jan Hubicka <hubicka at ucw dot cz>
- Date: Tue, 26 Aug 2014 23:29:42 +0200
- Subject: Re: [patch] Why xstrdup cgraph node names for dumpfiles?
- Authentication-results: sourceware.org; auth=none
- References: <CAFULd4aCEEoKYv+KMnUyqo6VGOiwV_+Ttt-C+sepE-1jY4VP-A at mail dot gmail dot com>
On Tue, Aug 26, 2014 at 10:52 PM, Uros Bizjak wrote:
> Hello!
>
>> I noticed most of the cgraph and IPA files use xstrdup for cgraph node
>> names when printing to dump_file. Very leaky...
>>
>> What is the reason for all those xstrdups? I couldn't think of any.
>
> Please see [1] and [2].
>
> [1] https://gcc.gnu.org/ml/gcc-patches/2012-04/msg01904.html
> [2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53136
Thanks. Well, that is surprising. The cxx_printable_name_internal uses
a ring buffer for caching the names. Apparently that didn't work in
your PR.
The leaks get quite large over time, especially with a large code base
and many small functions. I noticed this when compiling a large code
base with dumping enabled and ran out of memory.
I assume you also tried increasing the ring buffer size? Oh well,
probably not very robust, and we do seem to leak a lot of strings in
general...
Ciao!
Steven