[RFR] 8061715: gc/g1/TestShrinkAuxiliaryData15.java fails with java.lang.RuntimeException: heap decommit failed - after > before

Mikael Gerdin mikael.gerdin at oracle.com
Thu Mar 12 13:33:08 UTC 2015


Andrey,

On 2015-03-12 14:16, Andrey Zakharov wrote:
>
> 12.03.2015 15:55, Mikael Gerdin пишет:
>> Andrey,
>>
>> On 2015-03-12 12:51, Andrey Zakharov wrote:
>>> Tested in aurora as 742910.VMSQE.adhoc.JPRT.full. Looks good.
>>> Thanks.
>>>
>>> 11.03.2015 20:17, Andrey Zakharov пишет:
>>>>
>>>> 09.03.2015 15:26, Thomas Schatzl пишет:
>>>>> Hi Andrey,
>>>>>
>>>>> On Tue, 2015-03-03 at 18:40 +0300, Andrey Zakharov wrote:
>>>>>> Fixed according comments.
>>>>>>
>>>>>> hotspot webrev:
>>>>>> http://cr.openjdk.java.net/~azakharov/8061715/webrev.06/
>>
>> The following code is not correct with regards to the safepoint
>> protocol. You should not perform the ToNativeFromVM transition until
>> you have received the data from the VM. After the transition a GC
>> pause may occur while you are executing in
>> get_auxillary_data_memory_usage and you can get strange results.
>>
>>  328 WB_ENTRY(jobject, WB_G1AuxiliaryMemoryUsage(JNIEnv* env))
>>  329   ResourceMark rm(THREAD);
>>  330   ThreadToNativeFromVM ttn(thread);
>>  331   G1CollectedHeap* g1h = G1CollectedHeap::heap();
>>  332   MemoryUsage mu = g1h->get_auxiliary_data_memory_usage();
>>  333
>>  334   jclass jclass_memory_usage =
>> env->FindClass("java/lang/management/MemoryUsage");
>>  335   CHECK_JNI_EXCEPTION_(env, NULL);
>>  336   if (jclass_memory_usage == NULL) {
>>
>> I just found out that there is an existing function which creates a
>> java.lang.management.MemoryUsage from a C++ MemoryUsage object,
>> MemoryService::create_MemoryUsage_obj(MemoryUsage usage, TRAPS)
>>
>> Using this you can get rid of the state transition altogether and do
>> something like:
>>
>> WB_ENTRY(jobject, WB_G1AuxiliaryMemoryUsage(JNIEnv* env))
>>   G1CollectedHeap* g1h = G1CollectedHeap::heap();
>>   MemoryUsage mu = g1h->get_auxiliary_data_memory_usage();
>>   Handle h = MemoryService::create_MemoryUsage_obj(usage, CHECK_NULL);
>>   return JNIHandles::make_local(env, h());
>> WB_END
>>
>> This code is almost the same as jmm_GetMemoryPoolUsage in
>> management.cpp so if it doesn't compile see if I've missed something.
>> I'm pretty sure you don't need a ResourceMark for this function since
>> it does not allocate any memory in the resource area.
>>
>> /Mikael
>
> Hi, Mikael. Thanks for the tip. It makes things better here. But I'm in
> doubt about needless of ResourceMark. It exists in mentioned
> *jmm_GetMemoryPoolUsage:

Yes, but that code may be incorrect as well.
Anyway, keep the ResourceMark if you like.

/Mikael

>
> *JVM_ENTRY(jobject, jmm_GetMemoryPoolUsage(JNIEnv* env, jobject obj))
> *  ResourceMark rm(THREAD);*
>
>    MemoryPool* pool = get_memory_pool_from_jobject(obj, CHECK_NULL);
>    if (pool != NULL) {
>      MemoryUsage usage = pool->get_memory_usage();
>      Handle h = MemoryService::create_MemoryUsage_obj(usage, CHECK_NULL);
>      return JNIHandles::make_local(env, h());
>    } else {
>      return NULL;
>    }
> JVM_END*
>
> **
> *
>>
>>>>>>
>>>>>> hs-gc webrev:
>>>>>> http://cr.openjdk.java.net/~azakharov/8061715/webrev.06/hs-gc/
>>>>>>
>>>>>> testing: in progress
>>>>> Can you also provide the webrev for the hs-gc repository with the
>>>>> changes to whitebox.java?
>>>> Its provided.
>>>> testing looks good, latest on sthjprt as 2015-03-11-152816.gtee.auxdata
>>>> Thanks.
>>>>
>>>>> Thanks,
>>>>>    Thomas
>>>>>
>>>>>
>>>>>
>>>>
>>>
>



More information about the hotspot-gc-dev mailing list