RFR(M): 8235988: [c2] Memory leaks during tracing after '8224193: stringStream should not use Resouce Area'.

Lindenmaier, Goetz goetz.lindenmaier at sap.com
Mon Dec 16 13:38:59 UTC 2019


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/8235988-c2_tracing_mem_leak/01/

Best regards,
  Goetz.



More information about the hotspot-compiler-dev mailing list