[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 12:55:39 UTC 2015


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

>>>>
>>>> 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