< prev index next >

src/hotspot/share/gc/g1/g1CollectedHeap.hpp

Print this page
rev 48467 : 8137099: G1 needs to "upgrade" GC within the safepoint if it can't allocate during that safepoint to avoid OoME
Summary: During a minor GC, if memory allocation fails, start a full GC within the same VM operation in the same safepoint. This avoids a race where the GC locker can prevent the full GC from occurring, and a premature OoME.
Reviewed-by:
Contributed-by: thomas.schatzl@oracle.com, axel.siebenborn@sap.com
rev 48469 : imported patch 8137099-sjohanns-messages
rev 48470 : [mq]: 8137099-erikd-review
rev 48471 : [mq]: 8137099-erikd-review2


1046 
1047   size_t unused_committed_regions_in_bytes() const;
1048   virtual size_t capacity() const;
1049   virtual size_t used() const;
1050   // This should be called when we're not holding the heap lock. The
1051   // result might be a bit inaccurate.
1052   size_t used_unlocked() const;
1053   size_t recalculate_used() const;
1054 
1055   // These virtual functions do the actual allocation.
1056   // Some heaps may offer a contiguous region for shared non-blocking
1057   // allocation, via inlined code (by exporting the address of the top and
1058   // end fields defining the extent of the contiguous allocation region.)
1059   // But G1CollectedHeap doesn't yet support this.
1060 
1061   virtual bool is_maximal_no_gc() const {
1062     return _hrm.available() == 0;
1063   }
1064 
1065   // Returns whether there are any regions left in the heap for allocation.
1066   bool no_more_regions_left_for_allocation() const {
1067     return is_maximal_no_gc() && num_free_regions() == 0;
1068   }
1069 
1070   // The current number of regions in the heap.
1071   uint num_regions() const { return _hrm.length(); }
1072 
1073   // The max number of regions in the heap.
1074   uint max_regions() const { return _hrm.max_length(); }
1075 
1076   // The number of regions that are completely free.
1077   uint num_free_regions() const { return _hrm.num_free_regions(); }
1078 
1079   MemoryUsage get_auxiliary_data_memory_usage() const {
1080     return _hrm.get_auxiliary_data_memory_usage();
1081   }
1082 
1083   // The number of regions that are not completely free.
1084   uint num_used_regions() const { return num_regions() - num_free_regions(); }
1085 
1086 #ifdef ASSERT
1087   bool is_on_master_free_list(HeapRegion* hr) {




1046 
1047   size_t unused_committed_regions_in_bytes() const;
1048   virtual size_t capacity() const;
1049   virtual size_t used() const;
1050   // This should be called when we're not holding the heap lock. The
1051   // result might be a bit inaccurate.
1052   size_t used_unlocked() const;
1053   size_t recalculate_used() const;
1054 
1055   // These virtual functions do the actual allocation.
1056   // Some heaps may offer a contiguous region for shared non-blocking
1057   // allocation, via inlined code (by exporting the address of the top and
1058   // end fields defining the extent of the contiguous allocation region.)
1059   // But G1CollectedHeap doesn't yet support this.
1060 
1061   virtual bool is_maximal_no_gc() const {
1062     return _hrm.available() == 0;
1063   }
1064 
1065   // Returns whether there are any regions left in the heap for allocation.
1066   bool has_regions_left_for_allocation() const {
1067     return !is_maximal_no_gc() || num_free_regions() != 0;
1068   }
1069 
1070   // The current number of regions in the heap.
1071   uint num_regions() const { return _hrm.length(); }
1072 
1073   // The max number of regions in the heap.
1074   uint max_regions() const { return _hrm.max_length(); }
1075 
1076   // The number of regions that are completely free.
1077   uint num_free_regions() const { return _hrm.num_free_regions(); }
1078 
1079   MemoryUsage get_auxiliary_data_memory_usage() const {
1080     return _hrm.get_auxiliary_data_memory_usage();
1081   }
1082 
1083   // The number of regions that are not completely free.
1084   uint num_used_regions() const { return num_regions() - num_free_regions(); }
1085 
1086 #ifdef ASSERT
1087   bool is_on_master_free_list(HeapRegion* hr) {


< prev index next >