free the gc_thread structures during shutdown
authorSimon Marlow <marlowsd@gmail.com>
Fri, 24 Jul 2009 14:59:56 +0000 (14:59 +0000)
committerSimon Marlow <marlowsd@gmail.com>
Fri, 24 Jul 2009 14:59:56 +0000 (14:59 +0000)
rts/sm/GC.c
rts/sm/GC.h
rts/sm/Storage.c

index 7488006..88b11aa 100644 (file)
@@ -937,6 +937,23 @@ initGcThreads (void)
     }
 }
 
+void
+freeGcThreads (void)
+{
+    if (gc_threads != NULL) {
+#if defined(THREADED_RTS)
+        nat i;
+       for (i = 0; i < RtsFlags.ParFlags.nNodes; i++) {
+            stgFree (gc_threads[i]);
+       }
+        stgFree (gc_threads);
+#else
+        stgFree (gc_threads);
+#endif
+        gc_threads = NULL;
+    }
+}
+
 /* ----------------------------------------------------------------------------
    Start GC threads
    ------------------------------------------------------------------------- */
index fb6e385..fb4381d 100644 (file)
@@ -44,6 +44,7 @@ extern StgWord64 whitehole_spin;
 
 void gcWorkerThread (Capability *cap);
 void initGcThreads (void);
+void freeGcThreads (void);
 void waitForGcThreads (Capability *cap);
 void releaseGCThreads (Capability *cap);
 
index 9320232..d14e588 100644 (file)
@@ -284,6 +284,7 @@ freeStorage (void)
     closeMutex(&sm_mutex);
 #endif
     stgFree(nurseries);
+    freeGcThreads();
 }
 
 /* -----------------------------------------------------------------------------