RFR (XXS): 8132728: Memory leak in MethodHandles::verify_ref_kind function(fastdebug build)

Vladimir Ivanov vladimir.x.ivanov at oracle.com
Wed Aug 5 22:17:41 UTC 2015


Don't we reference freed memory from generated code after this fix?

stop() doesn't copy the message, but uses it as is:

void MacroAssembler::stop(const char* msg) {
   ExternalAddress message((address)msg);
   // push address of message
   pushptr(message.addr());
   ...
}

So, JVM can print garbage when hitting STOP if the memory was reused.

A proper fix would be to store the message somewhere in corresponding 
nmethod.

Best regards,
Vladimir Ivanov

On 8/5/15 8:54 PM, Vladimir Kozlov wrote:
> Looks good.
>
> Note, it is not real memory leak - code does not return from STOP call.
> It either produce assert and exit or wait to attach debugger
> (ShowMessageBoxOnError). See MacroAssembler::debug64() for example.
>
> Thanks,
> Vladimir
>
> On 8/5/15 9:55 AM, Dmitry Dmitriev wrote:
>> Hello,
>>
>> Please review this fix which remove small memory leak in debug build.
>> Also, I need a sponsor for this fix, who can push it.
>>
>> MethodHandles::verify_ref_kind contains memory leak. Memory for 'buf'
>> is allocated by NEW_C_HEAP_ARRAY but not freed
>> after '__ STOP(buf);'.
>>
>> Webrev: http://cr.openjdk.java.net/~ddmitriev/8132728/webrev.00/
>> JBS: https://bugs.openjdk.java.net/browse/JDK-8132728
>> Tested: JPRT(hotspot test set), hotspot all, vm.quick
>>
>> Thanks,
>> Dmitry


More information about the hotspot-compiler-dev mailing list