calcNeeded: fix the calculation, we weren't counting G0 step 1
authorsimonmar@microsoft.com <unknown>
Wed, 30 Jan 2008 15:07:30 +0000 (15:07 +0000)
committersimonmar@microsoft.com <unknown>
Wed, 30 Jan 2008 15:07:30 +0000 (15:07 +0000)
rts/sm/Storage.c

index 0bc15c0..8b3839f 100644 (file)
@@ -999,10 +999,11 @@ calcNeeded(void)
        for (s = 0; s < generations[g].n_steps; s++) {
            if (g == 0 && s == 0) { continue; }
            stp = &generations[g].steps[s];
-           if (generations[g].steps[0].n_blocks +
-               generations[g].steps[0].n_large_blocks 
-               > generations[g].max_blocks
-               && stp->is_compacted == 0) {
+           if (g == 0 || // always collect gen 0
+                (generations[g].steps[0].n_blocks +
+                 generations[g].steps[0].n_large_blocks 
+                 > generations[g].max_blocks
+                 && stp->is_compacted == 0)) {
                needed += 2 * stp->n_blocks + stp->n_large_blocks;
            } else {
                needed += stp->n_blocks + stp->n_large_blocks;