@@ -44,7 +44,6 @@ int ShenandoahHeuristics::compare_by_garbage(RegionData a, RegionData b) {
44
44
45
45
ShenandoahHeuristics::ShenandoahHeuristics () :
46
46
_region_data(NULL ),
47
- _region_data_size(0 ),
48
47
_degenerated_cycles_in_a_row(0 ),
49
48
_successful_cycles_in_a_row(0 ),
50
49
_bytes_in_cset(0 ),
@@ -59,26 +58,15 @@ ShenandoahHeuristics::ShenandoahHeuristics() :
59
58
if (!ClassUnloadingWithConcurrentMark) {
60
59
FLAG_SET_DEFAULT (ShenandoahUnloadClassesFrequency, 0 );
61
60
}
62
- }
63
61
64
- ShenandoahHeuristics::~ShenandoahHeuristics () {
65
- if (_region_data != NULL ) {
66
- FREE_C_HEAP_ARRAY (RegionGarbage, _region_data);
67
- }
62
+ size_t num_regions = ShenandoahHeap::heap ()-> num_regions ();
63
+ assert (num_regions > 0 , " Sanity " );
64
+
65
+ _region_data = NEW_C_HEAP_ARRAY (RegionData, num_regions, mtGC);
68
66
}
69
67
70
- ShenandoahHeuristics::RegionData* ShenandoahHeuristics::get_region_data_cache (size_t num) {
71
- RegionData* res = _region_data;
72
- if (res == NULL ) {
73
- res = NEW_C_HEAP_ARRAY (RegionData, num, mtGC);
74
- _region_data = res;
75
- _region_data_size = num;
76
- } else if (_region_data_size < num) {
77
- res = REALLOC_C_HEAP_ARRAY (RegionData, _region_data, num, mtGC);
78
- _region_data = res;
79
- _region_data_size = num;
80
- }
81
- return res;
68
+ ShenandoahHeuristics::~ShenandoahHeuristics () {
69
+ FREE_C_HEAP_ARRAY (RegionGarbage, _region_data);
82
70
}
83
71
84
72
void ShenandoahHeuristics::choose_collection_set (ShenandoahCollectionSet* collection_set) {
@@ -93,7 +81,7 @@ void ShenandoahHeuristics::choose_collection_set(ShenandoahCollectionSet* collec
93
81
94
82
size_t num_regions = heap->num_regions ();
95
83
96
- RegionData* candidates = get_region_data_cache (num_regions) ;
84
+ RegionData* candidates = _region_data ;
97
85
98
86
size_t cand_idx = 0 ;
99
87
0 commit comments