index

src/share/vm/gc_implementation/shared/vmGCOperations.cpp

Print this page
rev 7781 : imported patch 8066771
rev 7782 : [mq]: review


 282   // If expansion failed, do a last-ditch collection and try allocating
 283   // again.  A last-ditch collection will clear softrefs.  This
 284   // behavior is similar to the last-ditch collection done for perm
 285   // gen when it was full and a collection for failed allocation
 286   // did not free perm gen space.
 287   heap->collect_as_vm_thread(GCCause::_last_ditch_collection);
 288   _result = _loader_data->metaspace_non_null()->allocate(_size, _mdtype);
 289   if (_result != NULL) {
 290     return;
 291   }
 292 
 293   if (Verbose && PrintGCDetails) {
 294     gclog_or_tty->print_cr("\nAfter Metaspace GC failed to allocate size "
 295                            SIZE_FORMAT, _size);
 296   }
 297 
 298   if (GC_locker::is_active_and_needs_gc()) {
 299     set_gc_locked();
 300   }
 301 }
 302 
 303 VM_CollectForAllocation::VM_CollectForAllocation(size_t word_size, uint gc_count_before, GCCause::Cause cause) :
 304     VM_GC_Operation(gc_count_before, cause), _result(NULL), _word_size(word_size) {
 305   // G1's incremental collections are not always caused by an allocation, which is indicated by word_size = 0.
 306   assert(_word_size != 0 || UseG1GC, "word_size = 0 should only happen with G1");
 307 }


 282   // If expansion failed, do a last-ditch collection and try allocating
 283   // again.  A last-ditch collection will clear softrefs.  This
 284   // behavior is similar to the last-ditch collection done for perm
 285   // gen when it was full and a collection for failed allocation
 286   // did not free perm gen space.
 287   heap->collect_as_vm_thread(GCCause::_last_ditch_collection);
 288   _result = _loader_data->metaspace_non_null()->allocate(_size, _mdtype);
 289   if (_result != NULL) {
 290     return;
 291   }
 292 
 293   if (Verbose && PrintGCDetails) {
 294     gclog_or_tty->print_cr("\nAfter Metaspace GC failed to allocate size "
 295                            SIZE_FORMAT, _size);
 296   }
 297 
 298   if (GC_locker::is_active_and_needs_gc()) {
 299     set_gc_locked();
 300   }
 301 }






index