1537 gc_tracer->report_gc_end(gc_timer->gc_end(), gc_timer->time_partitions()); 1538 1539 return true; 1540 } 1541 1542 void G1CollectedHeap::do_full_collection(bool clear_all_soft_refs) { 1543 // do_collection() will return whether it succeeded in performing 1544 // the GC. Currently, there is no facility on the 1545 // do_full_collection() API to notify the caller than the collection 1546 // did not succeed (e.g., because it was locked out by the GC 1547 // locker). So, right now, we'll ignore the return value. 1548 bool dummy = do_collection(true, /* explicit_gc */ 1549 clear_all_soft_refs, 1550 0 /* word_size */); 1551 } 1552 1553 // This code is mostly copied from TenuredGeneration. 1554 void 1555 G1CollectedHeap:: 1556 resize_if_necessary_after_full_collection(size_t word_size) { 1557 assert(MinHeapFreeRatio <= MaxHeapFreeRatio, "sanity check"); 1558 1559 // Include the current allocation, if any, and bytes that will be 1560 // pre-allocated to support collections, as "used". 1561 const size_t used_after_gc = used(); 1562 const size_t capacity_after_gc = capacity(); 1563 const size_t free_after_gc = capacity_after_gc - used_after_gc; 1564 1565 // This is enforced in arguments.cpp. 1566 assert(MinHeapFreeRatio <= MaxHeapFreeRatio, 1567 "otherwise the code below doesn't make sense"); 1568 1569 // We don't have floating point command-line arguments 1570 const double minimum_free_percentage = (double) MinHeapFreeRatio / 100.0; 1571 const double maximum_used_percentage = 1.0 - minimum_free_percentage; 1572 const double maximum_free_percentage = (double) MaxHeapFreeRatio / 100.0; 1573 const double minimum_used_percentage = 1.0 - maximum_free_percentage; 1574 1575 const size_t min_heap_size = collector_policy()->min_heap_byte_size(); 1576 const size_t max_heap_size = collector_policy()->max_heap_byte_size(); 1577 1578 // We have to be careful here as these two calculations can overflow | 1537 gc_tracer->report_gc_end(gc_timer->gc_end(), gc_timer->time_partitions()); 1538 1539 return true; 1540 } 1541 1542 void G1CollectedHeap::do_full_collection(bool clear_all_soft_refs) { 1543 // do_collection() will return whether it succeeded in performing 1544 // the GC. Currently, there is no facility on the 1545 // do_full_collection() API to notify the caller than the collection 1546 // did not succeed (e.g., because it was locked out by the GC 1547 // locker). So, right now, we'll ignore the return value. 1548 bool dummy = do_collection(true, /* explicit_gc */ 1549 clear_all_soft_refs, 1550 0 /* word_size */); 1551 } 1552 1553 // This code is mostly copied from TenuredGeneration. 1554 void 1555 G1CollectedHeap:: 1556 resize_if_necessary_after_full_collection(size_t word_size) { 1557 // Include the current allocation, if any, and bytes that will be 1558 // pre-allocated to support collections, as "used". 1559 const size_t used_after_gc = used(); 1560 const size_t capacity_after_gc = capacity(); 1561 const size_t free_after_gc = capacity_after_gc - used_after_gc; 1562 1563 // This is enforced in arguments.cpp. 1564 assert(MinHeapFreeRatio <= MaxHeapFreeRatio, 1565 "otherwise the code below doesn't make sense"); 1566 1567 // We don't have floating point command-line arguments 1568 const double minimum_free_percentage = (double) MinHeapFreeRatio / 100.0; 1569 const double maximum_used_percentage = 1.0 - minimum_free_percentage; 1570 const double maximum_free_percentage = (double) MaxHeapFreeRatio / 100.0; 1571 const double minimum_used_percentage = 1.0 - maximum_free_percentage; 1572 1573 const size_t min_heap_size = collector_policy()->min_heap_byte_size(); 1574 const size_t max_heap_size = collector_policy()->max_heap_byte_size(); 1575 1576 // We have to be careful here as these two calculations can overflow |