#endif //!USE_REGIONS
#ifdef DYNAMIC_HEAP_COUNT
+int gc_heap::dynamic_adaptation_mode = dynamic_adaptation_default;
gc_heap::dynamic_heap_count_data_t SVR::gc_heap::dynamic_heap_count_data;
#endif // DYNAMIC_HEAP_COUNT
HRESULT hres = S_OK;
+ conserve_mem_setting = (int)GCConfig::GetGCConserveMem();
+
+#ifdef DYNAMIC_HEAP_COUNT
+ dynamic_adaptation_mode = (int)GCConfig::GetGCDynamicAdaptationMode();
+ if (GCConfig::GetHeapCount() != 0)
+ {
+ dynamic_adaptation_mode = 0;
+ }
+
+ if ((dynamic_adaptation_mode == dynamic_adaptation_to_application_sizes) && (conserve_mem_setting == 0))
+ conserve_mem_setting = 5;
+#endif //DYNAMIC_HEAP_COUNT
+
+ if (conserve_mem_setting < 0)
+ conserve_mem_setting = 0;
+ if (conserve_mem_setting > 9)
+ conserve_mem_setting = 9;
+
+ dprintf (1, ("conserve_mem_setting = %d", conserve_mem_setting));
+
#ifdef WRITE_WATCH
hardware_write_watch_api_supported();
#ifdef BACKGROUND_GC
#ifdef MULTIPLE_HEAPS
mark_list_size = min (100*1024, max (8192, soh_segment_size/(2*10*32)));
#ifdef DYNAMIC_HEAP_COUNT
- if (GCConfig::GetGCDynamicAdaptationMode() == 1 && GCConfig::GetHeapCount() == 0)
+ if (dynamic_adaptation_mode == dynamic_adaptation_to_application_sizes)
{
// we'll actually start with one heap in this case
g_mark_list_total_size = mark_list_size;
#endif //FEATURE_LOH_COMPACTION
#endif //FEATURE_EVENT_TRACE
- conserve_mem_setting = (int)GCConfig::GetGCConserveMem();
- if (conserve_mem_setting == 0 && GCConfig::GetGCDynamicAdaptationMode() == 1)
- conserve_mem_setting = 5;
- if (conserve_mem_setting < 0)
- conserve_mem_setting = 0;
- if (conserve_mem_setting > 9)
- conserve_mem_setting = 9;
-
- dprintf (1, ("conserve_mem_setting = %d", conserve_mem_setting));
-
reset_mm_p = TRUE;
ret = 1;
int n_alloc = n;
if (heap_number == 0)
{
- dprintf (5555, ("init: %d(%d)", n_initial, settings.reason));
+ dprintf (GTC_LOG, ("init: %d(%d)", n_initial, settings.reason));
}
int i = 0;
int temp_gen = 0;
gc_t_join.restart();
}
-#ifdef USE_REGIONS
-// rethread_fl_items ();
-#endif //USE_REGIONS
-
update_end_gc_time_per_heap();
add_to_history_per_heap();
alloc_context_count = 0;
{
dynamic_heap_count_data.new_n_heaps = n_heaps;
- if (GCConfig::GetHeapCount() != 0)
- {
- // don't change the heap count if we see an environment variable setting it explicitly
- return;
- }
-
- if (GCConfig::GetGCDynamicAdaptationMode() == 0)
+ if (dynamic_adaptation_mode != dynamic_adaptation_to_application_sizes)
{
- // don't change the heap count dynamically if the feature isn't explicitly enabled
return;
}
max (min_gc_size, (max_size/3)));
}
- if (conserve_mem_setting != 0)
+#ifdef DYNAMIC_HEAP_COUNT
+ if (dynamic_adaptation_mode == dynamic_adaptation_to_application_sizes)
{
// if this is set, limit gen 0 size to a small multiple of the older generations
float f_older_gen = ((10.0f / conserve_mem_setting) - 1) * 0.5f;
older_size,
new_allocation));
}
+#endif //DYNAMIC_HEAP_COUNT
}
}
{
#ifdef DYNAMIC_HEAP_COUNT
// if no heap count was specified, and we are told to adjust heap count dynamically ...
- if (GCConfig::GetHeapCount() == 0 && GCConfig::GetGCDynamicAdaptationMode() == 1)
+ if (gc_heap::dynamic_adaptation_mode == dynamic_adaptation_to_application_sizes)
{
- // ... start with only 1 heap
+ // start with only 1 heap
gc_heap::smoothed_desired_total[0] /= gc_heap::n_heaps;
gc_heap::g_heaps[0]->change_heap_count (1);
}
int n_heaps = 1;
#endif //SERVER_GC
- if (GCConfig::GetGCConserveMem() != 0 || GCConfig::GetGCDynamicAdaptationMode() == 1)
+#ifdef DYNAMIC_HEAP_COUNT
+ if (dynamic_adaptation_mode == dynamic_adaptation_to_application_sizes)
{
// if we are asked to be stingy with memory, limit gen 0 size
gen0size = min (gen0size, (4*1024*1024));
}
+#endif //DYNAMIC_HEAP_COUNT
dprintf (1, ("gen0size: %zd * %d = %zd, physical mem: %zd / 6 = %zd",
gen0size, n_heaps, (gen0size * n_heaps),