total_old_card_surv += g_heaps[hp_idx]->old_card_survived_per_region[region_index];
}
- heap_segment_survived (current_region) = (int)total_surv;
+ heap_segment_survived (current_region) = total_surv;
heap_segment_old_card_survived (current_region) = (int)total_old_card_surv;
#else
- heap_segment_survived (current_region) = (int)(survived_per_region[region_index]);
+ heap_segment_survived (current_region) = survived_per_region[region_index];
heap_segment_old_card_survived (current_region) =
(int)(old_card_survived_per_region[region_index]);
#endif //MULTIPLE_HEAPS
- dprintf (REGIONS_LOG, ("region #%zd %p surv %d, old card surv %d",
+ dprintf (REGIONS_LOG, ("region #%zd %p surv %zd, old card surv %d",
region_index,
heap_segment_mem (current_region),
heap_segment_survived (current_region),
{
break;
}
- assert (surv_per_heap[i] >= (size_t)heap_segment_survived (region));
- dprintf (REGIONS_LOG, ("heap: %d surv: %zd - %d = %zd",
+ assert (surv_per_heap[i] >= heap_segment_survived (region));
+ dprintf (REGIONS_LOG, ("heap: %d surv: %zd - %zd = %zd",
i,
surv_per_heap[i],
heap_segment_survived (region),
heap_segment_next (region) = surplus_regions;
surplus_regions = region;
- max_survived = max (max_survived, (size_t)heap_segment_survived (region));
+ max_survived = max (max_survived, heap_segment_survived (region));
}
if (surv_per_heap[i] < avg_surv_per_heap)
{
heap_segment* next_region;
for (heap_segment* region = surplus_regions; region != nullptr; region = next_region)
{
- int size_class = (int)(heap_segment_survived (region)*survived_scale_factor);
+ size_t size_class = (size_t)(heap_segment_survived (region)*survived_scale_factor);
assert ((0 <= size_class) && (size_class < NUM_SIZE_CLASSES));
next_region = heap_segment_next (region);
heap_segment_next (region) = surplus_regions_by_size_class[size_class];
g_heaps[heap_num]->thread_rw_region_front (gen_idx, region);
// adjust survival for this heap
- dprintf (REGIONS_LOG, ("heap: %d surv: %zd + %d = %zd",
+ dprintf (REGIONS_LOG, ("heap: %d surv: %zd + %zd = %zd",
heap_num,
surv_per_heap[heap_num],
heap_segment_survived (region),
if (heap_segment_swept_in_plan (current_region))
{
int gen_num = heap_segment_gen_num (current_region);
- dprintf (REGIONS_LOG, ("threading SIP region %p surv %d onto gen%d",
+ dprintf (REGIONS_LOG, ("threading SIP region %p surv %zd onto gen%d",
heap_segment_mem (current_region), heap_segment_survived (current_region), gen_num));
generation* gen = generation_of (gen_num);
size_t basic_region_size = (size_t)1 << min_segment_size_shr;
assert (heap_segment_gen_num (region) == heap_segment_plan_gen_num (region));
- int surv_ratio = (int)(((double)heap_segment_survived (region) * 100.0) / (double)basic_region_size);
- dprintf (2222, ("SSIP: region %p surv %d / %zd = %d%%(%d)",
+ uint8_t surv_ratio = (uint8_t)(((double)heap_segment_survived (region) * 100.0) / (double)basic_region_size);
+ dprintf (2222, ("SSIP: region %p surv %hu / %zd = %d%%(%d)",
heap_segment_mem (region),
heap_segment_survived (region),
basic_region_size,
size_t region_index = get_basic_region_index_for_address (heap_segment_mem (region));
dprintf (REGIONS_LOG, ("region #%zd %p survived %zd, %s recorded %d",
region_index, heap_segment_mem (region), survived,
- ((survived == (size_t)heap_segment_survived (region)) ? "same as" : "diff from"),
+ ((survived == heap_segment_survived (region)) ? "same as" : "diff from"),
heap_segment_survived (region)));
#ifdef MULTIPLE_HEAPS
- assert (survived <= (size_t)heap_segment_survived (region));
+ assert (survived <= heap_segment_survived (region));
#else
- assert (survived == (size_t)heap_segment_survived (region));
+ assert (survived == heap_segment_survived (region));
#endif //MULTIPLE_HEAPS
#endif //_DEBUG
gc_heap::enable_special_regions_p = (bool)GCConfig::GetGCEnableSpecialRegions();
size_t gc_region_size = (size_t)GCConfig::GetGCRegionSize();
+ // Constraining the size of region size to be < 2 GB.
+ if (gc_region_size >= MAX_REGION_SIZE)
+ {
+ return CLR_E_GC_BAD_REGION_SIZE;
+ }
+
// Adjust GCRegionSize based on how large each heap would be, for smaller heaps we would
// like to keep Region sizes small. We choose between 4, 2 and 1mb based on the calculations
// below (unless its configured explictly) such that there are at least 2 regions available