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

Mikael Gerdin mikael.gerdin at oracle.com
Mon Mar 16 14:10:16 UTC 2015


Forgot to include hotspot-gc-dev.
Also, my statement below about "jobject o" is incorrect.
It corresponds to "this", the whitebox instance.

/Mikael

On 2015-03-16 14:09, Mikael Gerdin wrote:
> Hi Andrey,
>
> On 2015-03-13 13:00, Andrey Zakharov wrote:
>> Hi, team
>>
>> Last one webrev.07 was with sad mistake - not removed ToNativeFromVM
>> call.
>> here is fixed
>>
>> webrev:
>> http://cr.openjdk.java.net/~azakharov/8061715/webrev.08/
>
> I think it looks good.
> A minor issue is that WB_G1NumMaxRegions is not declared to take a
> parameter but still has a "jobject o" in the parameter list.
> This problem exists for several other G1 related WB functions so let's
> leave that for a separate cleanup.
>
>
>>
>> hs-gc same:
>> http://cr.openjdk.java.net/~azakharov/8061715/webrev.06/hs-gc/
>
> Looks good as well.
> I think this is ready to go now.
>
> /Mikael
>
>>
>> testing: ok on STH queue  2015-03-13-103151.gtee.auxdata
>>
>> Thanks.
>>
>> 12.03.2015 19:46, Andrey Zakharov пишет:
>>> Fixed
>>> webrev: http://cr.openjdk.java.net/~azakharov/8061715/webrev.07/
>>>
>>> hs-gc is same:
>>> http://cr.openjdk.java.net/~azakharov/8061715/webrev.06/hs-gc/
>>>
>>> Testing on the run: STH queue - 2015-03-12-160604.gtee.auxdata
>>>
>>> Thanks.
>>>
>>> 12.03.2015 16:16, Andrey Zakharov пишет:
>>>> 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:
>>>>
>>>> *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*
>>>>
>>>> *
>>>
>>



More information about the hotspot-gc-dev mailing list