A small utility

Peter B. Kessler Peter.B.Kessler at Oracle.COM
Tue May 29 10:35:31 PDT 2012


Somewhere at that level there's also a collection of objects that get allocated close to the bottom of the old generation that get dropped one at a time so that all of the heap above them is forced to be relocated.  That's good for finding objects that you forget to move or to forget to update references to them.

			... peter

David Holmes wrote:
> Hi Andrew,
> 
> In non-product builds there is FullGCALot with associated 
> FullGCALotInterval, and a start delay FullGCALotStart. I don't know the 
> exact details.
> 
> David
> 
> On 28/05/2012 10:07 PM, Andrew Haley wrote:
>> We were having a lot of difficulty with our ARM port: there was a
>> very rare crash in the garbage collector.  This little patch helped
>> a lot.  It's a thread that forces a full GC at some fixed interval,
>> here 500ms.  I don't know if anything similar exists in the HotSpot
>> developer sources, but I couldn't find it.  Offered here not as a
>> request for a commit, but in the hope that someone might find it
>> useful.
>>
>> Andrew.
>>
>>
>>
>> diff -r f293db049783 src/share/vm/runtime/vmThread.cpp
>> --- a/src/share/vm/runtime/vmThread.cpp Mon May 28 08:01:18 2012 -0400
>> +++ b/src/share/vm/runtime/vmThread.cpp Mon May 28 08:01:38 2012 -0400
>> @@ -245,6 +245,39 @@
>>     }
>>   }
>>
>> +class BangerThread : NamedThread
>> +{
>> +public:
>> +
>> +  static BangerThread *the_thread;
>> +
>> +  static void create() {
>> +    the_thread = new BangerThread();
>> +    os::create_thread (the_thread, os::watcher_thread);
>> +    Thread::start(the_thread);
>> +  }
>> +
>> +  BangerThread() : NamedThread() {
>> +    set_name("banger");
>> +  }
>> +
>> +  void run() {
>> +    struct timespec req;
>> +    req.tv_nsec = 0.5e9;
>> +    req.tv_sec = 0;
>> +
>> +    for (;;)
>> +      {
>> +       nanosleep(&req, NULL);
>> +       // VM_ForceSafepoint op;
>> +       // VMThread::execute(&op);
>> +       Universe::heap()->collect(GCCause::_java_lang_system_gc);
>> +      }
>> +  }
>> +};
>> +
>> +BangerThread *BangerThread::the_thread;
>> +
>>   void VMThread::run() {
>>     assert(this == vm_thread(), "check");
>>
>> @@ -269,6 +302,8 @@
>>     // possible to set the VM thread priority higher than any Java 
>> thread.
>>     os::set_native_priority( this, prio );
>>
>> +  BangerThread::create();
>> +
>>     // Wait for VM_Operations until termination
>>     this->loop();
>>


More information about the hotspot-dev mailing list