diff options
author | Simon Marlow <marlowsd@gmail.com> | 2009-07-24 14:59:56 +0000 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2009-07-24 14:59:56 +0000 |
commit | 0c6929858665ae0e9918fe0c6c71ce26fd4a4461 (patch) | |
tree | 82072950bfa9a009410906880524ef3f69f4fe4f /rts/sm | |
parent | 2da67673279cf015ccc84270f6fd7935f64261a6 (diff) | |
download | haskell-0c6929858665ae0e9918fe0c6c71ce26fd4a4461.tar.gz |
free the gc_thread structures during shutdown
Diffstat (limited to 'rts/sm')
-rw-r--r-- | rts/sm/GC.c | 17 | ||||
-rw-r--r-- | rts/sm/GC.h | 1 | ||||
-rw-r--r-- | rts/sm/Storage.c | 1 |
3 files changed, 19 insertions, 0 deletions
diff --git a/rts/sm/GC.c b/rts/sm/GC.c index 74880064e4..88b11aae88 100644 --- a/rts/sm/GC.c +++ b/rts/sm/GC.c @@ -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 ------------------------------------------------------------------------- */ diff --git a/rts/sm/GC.h b/rts/sm/GC.h index fb6e385979..fb4381dc0b 100644 --- a/rts/sm/GC.h +++ b/rts/sm/GC.h @@ -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); diff --git a/rts/sm/Storage.c b/rts/sm/Storage.c index 9320232e97..d14e58856f 100644 --- a/rts/sm/Storage.c +++ b/rts/sm/Storage.c @@ -284,6 +284,7 @@ freeStorage (void) closeMutex(&sm_mutex); #endif stgFree(nurseries); + freeGcThreads(); } /* ----------------------------------------------------------------------------- |