debug output: show mem in use
[ghc-hetmet.git] / rts / sm / GC.c
index 2b6dbb7..b381e56 100644 (file)
@@ -253,8 +253,8 @@ GarbageCollect ( rtsBool force_major_gc )
 #else
   n_gc_threads = 1;
 #endif
-  trace(TRACE_gc|DEBUG_gc, "GC (gen %d): %dKB to collect, using %d thread(s)",
-        N, n * (BLOCK_SIZE / 1024), n_gc_threads);
+  trace(TRACE_gc|DEBUG_gc, "GC (gen %d): %d KB to collect, %ld MB in use, using %d thread(s)",
+        N, n * (BLOCK_SIZE / 1024), mblocks_allocated, n_gc_threads);
 
 #ifdef RTS_GTK_FRONTPANEL
   if (RtsFlags.GcFlags.frontpanel) {
@@ -420,7 +420,12 @@ GarbageCollect ( rtsBool force_major_gc )
          thr = gc_threads[t];
 
           // not step 0
-          for (s = 1; s < total_steps; s++) {
+          if (RtsFlags.GcFlags.generations == 1) {
+              s = 0;
+          } else {
+              s = 1;
+          }
+          for (; s < total_steps; s++) {
               ws = &thr->steps[s];
 
               // Push the final block
@@ -472,19 +477,6 @@ GarbageCollect ( rtsBool force_major_gc )
       }
   }
 
-  // Two-space collector: swap the semi-spaces around.
-  // Currently: g0s0->old_blocks is the old nursery
-  //            g0s0->blocks is to-space from this GC
-  // We want these the other way around.
-  if (RtsFlags.GcFlags.generations == 1) {
-      bdescr *nursery_blocks = g0s0->old_blocks;
-      nat n_nursery_blocks = g0s0->n_old_blocks;
-      g0s0->old_blocks = g0s0->blocks;
-      g0s0->n_old_blocks = g0s0->n_blocks;
-      g0s0->blocks = nursery_blocks;
-      g0s0->n_blocks = n_nursery_blocks;
-  }
-
   /* run through all the generations/steps and tidy up 
    */
   copied = 0;
@@ -1439,7 +1431,7 @@ resize_nursery (void)
         * performance we get from 3L bytes, reducing to the same
         * performance at 2L bytes.
         */
-       blocks = g0s0->n_old_blocks;
+       blocks = g0s0->n_blocks;
        
        if ( RtsFlags.GcFlags.maxHeapSize != 0 &&
             blocks * RtsFlags.GcFlags.oldGenFactor * 2 >