-H alone causes the RTS to use a larger nursery, but without exceeding
the amount of memory that the application is already using. It trades
off GC time against locality: the default setting is to use a
fixed-size 512k nursery, but this is sometimes worse than using a very
large nursery despite the worse locality.
Not all programs get faster, but some programs that use large heaps do
much better with -H. e.g. this helps a lot with #3061 (binary-trees),
though not as much as specifying -H<large>. Typically using -H<large>
is better than plain -H, because the runtime doesn't know ahead of
time how much memory you want to use.
Should -H be on by default? I'm not sure, it makes some programs go
slower, but others go faster.
nat minAllocAreaSize; /* in *blocks* */
nat minOldGenSize; /* in *blocks* */
nat heapSizeSuggestion; /* in *blocks* */
nat minAllocAreaSize; /* in *blocks* */
nat minOldGenSize; /* in *blocks* */
nat heapSizeSuggestion; /* in *blocks* */
+ rtsBool heapSizeSuggestionAuto;
double oldGenFactor;
double pcFreeHeap;
double oldGenFactor;
double pcFreeHeap;
RtsFlags.GcFlags.minOldGenSize = (1024 * 1024) / BLOCK_SIZE;
RtsFlags.GcFlags.maxHeapSize = 0; /* off by default */
RtsFlags.GcFlags.heapSizeSuggestion = 0; /* none */
RtsFlags.GcFlags.minOldGenSize = (1024 * 1024) / BLOCK_SIZE;
RtsFlags.GcFlags.maxHeapSize = 0; /* off by default */
RtsFlags.GcFlags.heapSizeSuggestion = 0; /* none */
+ RtsFlags.GcFlags.heapSizeSuggestionAuto = rtsFalse;
RtsFlags.GcFlags.pcFreeHeap = 3; /* 3% */
RtsFlags.GcFlags.oldGenFactor = 2;
RtsFlags.GcFlags.generations = 2;
RtsFlags.GcFlags.pcFreeHeap = 3; /* 3% */
RtsFlags.GcFlags.oldGenFactor = 2;
RtsFlags.GcFlags.generations = 2;
- RtsFlags.GcFlags.heapSizeSuggestion =
- (nat)(decodeSize(rts_argv[arg], 2, BLOCK_SIZE, HS_WORD_MAX) / BLOCK_SIZE);
- break;
+ if (rts_argv[arg][2] == '\0') {
+ RtsFlags.GcFlags.heapSizeSuggestionAuto = rtsTrue;
+ } else {
+ RtsFlags.GcFlags.heapSizeSuggestion =
+ (nat)(decodeSize(rts_argv[arg], 2, BLOCK_SIZE, HS_WORD_MAX) / BLOCK_SIZE);
+ }
+ break;
#ifdef RTS_GTK_FRONTPANEL
case 'f':
#ifdef RTS_GTK_FRONTPANEL
case 'f':
size = stg_max(live * RtsFlags.GcFlags.oldGenFactor,
RtsFlags.GcFlags.minOldGenSize);
size = stg_max(live * RtsFlags.GcFlags.oldGenFactor,
RtsFlags.GcFlags.minOldGenSize);
+ if (RtsFlags.GcFlags.heapSizeSuggestionAuto) {
+ RtsFlags.GcFlags.heapSizeSuggestion = size;
+ }
+
// minimum size for generation zero
min_alloc = stg_max((RtsFlags.GcFlags.pcFreeHeap * max) / 200,
RtsFlags.GcFlags.minAllocAreaSize);
// minimum size for generation zero
min_alloc = stg_max((RtsFlags.GcFlags.pcFreeHeap * max) / 200,
RtsFlags.GcFlags.minAllocAreaSize);