When using -H with -M<size>, don't exceed the maximum heap size
authorSimon Marlow <marlowsd@gmail.com>
Fri, 7 Sep 2012 12:35:16 +0000 (13:35 +0100)
committerPaolo Capriotti <p.capriotti@gmail.com>
Sun, 9 Sep 2012 10:43:56 +0000 (11:43 +0100)
MERGED from commit 4d208aed2f433cd2f46a7df016bad50af2e07e40

rts/sm/GC.c

index c742fde..21b80ea 100644 (file)
@@ -1570,7 +1570,11 @@ resize_generations (void)
                       RtsFlags.GcFlags.minOldGenSize);
        
         if (RtsFlags.GcFlags.heapSizeSuggestionAuto) {
-            RtsFlags.GcFlags.heapSizeSuggestion = size;
+            if (max > 0) {
+                RtsFlags.GcFlags.heapSizeSuggestion = stg_min(max, size);
+            } else {
+                RtsFlags.GcFlags.heapSizeSuggestion = size;
+            }
         }
 
        // minimum size for generation zero