RFR(xs): 8159019: ResourceMark in ClassLoader::open_versioned_entry() is being used incorrectly

Ioi Lam ioi.lam at oracle.com
Thu Jun 9 00:54:00 UTC 2016


David,

There are quite a few cases where resource-allocated buffers are 
allocated. E.g.

   const char* Symbol::as_klass_external_name() const;

I don't think there's a rule against such usage. I think the rule should 
be -- if a function is returning a resource-allocated buffer, don't do 
the allocation within a ResourceMark declared by this function. This is 
exactly what's done by Calvin's fix. It looks good to me.

Thanks
- Ioi

On 6/8/16 5:19 PM, David Holmes wrote:
> Hi Calvin,
>
> On 9/06/2016 4:01 AM, Calvin Cheung wrote:
>>
>> Please review this small fix for correcting the use of ResourceMark in
>> classLoader.cpp.
>>
>> bug: https://bugs.openjdk.java.net/browse/JDK-8159019
>> webrev: http://cr.openjdk.java.net/~ccheung/8159019/webrev.00/
>
> I think this really fixes the wrong problem. I don't think 
> ClassPathZipEntry::open_entry should be returning a resource-allocated 
> buffer in the first place. The lifecycle management is not suitable.
>
> David
> -----
>
>> Tested manually with the affected testcase on linux_x64.
>> Running tests on all platforms.
>>
>> thanks,
>> Calvin



More information about the hotspot-runtime-dev mailing list