RFR(M): 8235998: [c2] Memory leaks during tracing after '8224193: stringStream should not use Resouce Area'.
Vladimir Kozlov
vladimir.kozlov at oracle.com
Wed Dec 18 02:40:08 UTC 2019
CCing to Runtime group.
For me the use of `_print_inlining_stream->~stringStream()` is not obvious.
I would definitively miss to do that if I use stringStreams in some new code.
May be someone can suggest some C++ trick to do that automatically.
Thanks,
Vladimir
On 12/16/19 6:34 AM, Lindenmaier, Goetz wrote:
> Hi,
>
> I'm resending this with fixed bugId ...
> Sorry!
>
> Best regards,
> Goetz
>
>> Hi,
>>
>> PrintInlining and TraceLoopPredicate allocate stringStreams with new and
>> relied on the fact that all memory used is on the ResourceArea cleaned
>> after the compilation.
>>
>> Since 8224193 the char* of the stringStream is malloced and thus
>> must be freed. No doing so manifests a memory leak.
>> This is only relevant if the corresponding tracing is active.
>>
>> To fix TraceLoopPredicate I added the destructor call
>> Fixing PrintInlining is a bit more complicated, as it uses several
>> stringStreams. A row of them is in a GrowableArray which must
>> be walked to free all of them.
>> As the GrowableArray is on an arena no destructor is called for it.
>>
>> I also changed some as_string() calls to base() calls which reduced
>> memory need of the traces, and added a comment explaining the
>> constructor of GrowableArray that calls the copyconstructor for its
>> elements.
>>
>> Please review:
>> http://cr.openjdk.java.net/~goetz/wr19/8235998-c2_tracing_mem_leak/01/
>>
>> Best regards,
>> Goetz.
>
More information about the hotspot-runtime-dev
mailing list