How to exercise the GC notification code in gcNotifier.cpp

Mandy Chung mandy.chung at
Thu Aug 4 18:08:07 PDT 2011

On 8/4/11 3:12 PM, John Cuthbertson wrote:
> Hi Everyone,
> After investigating an issue that was reported while running a fairly 
> substantial application, I believe I have found naked oop in the GC 
> notification code which I think is the cause of the problem The oop in 
> question is the muKlass oop in createGCInfo in gcNotifier.cpp. This 
> code is executed by the ServiceThread as part of the sendNotification 
> routine which pulls items from some request queue. The items on this 
> queue seem to be added as a result of GC end events being pushed by 
> the MemoryManagerService if the routine 
> GCMemoryManager::is_notification_enabled() returns true. This field is 
> set to true by the routine jmm_SetGCNotificationEnabled in 
> management.cpp. Can anyone tell me how I can explicitly exercise this 
> code? I have tried some things in jconsole and jvisualvm but have so 
> far been unsuccessful.

You can use the unit test:

To enable it, it has to add a JMX notification listener (the call to 
mbs.addNotificationListener method).

This is the VM support for the new API added in JDK 7:


> Thanks,

> JohnC

More information about the hotspot-runtime-dev mailing list