summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rts/Capability.c2
-rw-r--r--rts/RtsStartup.c7
-rw-r--r--rts/Sparks.c5
-rw-r--r--rts/Sparks.h1
-rw-r--r--rts/ThreadLabels.c9
-rw-r--r--rts/ThreadLabels.h1
-rw-r--r--rts/sm/Storage.c1
7 files changed, 25 insertions, 1 deletions
diff --git a/rts/Capability.c b/rts/Capability.c
index f1c625ef7c..3d55b421f8 100644
--- a/rts/Capability.c
+++ b/rts/Capability.c
@@ -673,6 +673,8 @@ shutdownCapability (Capability *cap, Task *task)
continue;
}
debugTrace(DEBUG_sched, "capability %d is stopped.", cap->no);
+ stgFree(cap->mut_lists);
+ freeSparkPool(&cap->r.rSparks);
RELEASE_LOCK(&cap->lock);
break;
}
diff --git a/rts/RtsStartup.c b/rts/RtsStartup.c
index 937334bdab..87df96a13c 100644
--- a/rts/RtsStartup.c
+++ b/rts/RtsStartup.c
@@ -444,9 +444,14 @@ hs_exit(void)
/* free shared Typeable store */
exitTypeableStore();
- /* initialise the stable pointer table */
+ /* free the stable pointer table */
exitStablePtrTable();
+#if defined(DEBUG)
+ /* free the thread label table */
+ freeThreadLabelTable();
+#endif
+
/* free hash table storage */
exitHashTable();
diff --git a/rts/Sparks.c b/rts/Sparks.c
index 40ebcad7a7..ca60e1338c 100644
--- a/rts/Sparks.c
+++ b/rts/Sparks.c
@@ -63,6 +63,11 @@ initSparkPools( void )
#endif
}
+void
+freeSparkPool(StgSparkPool *pool) {
+ stgFree(pool->base);
+}
+
/* -----------------------------------------------------------------------------
*
* findSpark: find a spark on the current Capability that we can fork
diff --git a/rts/Sparks.h b/rts/Sparks.h
index 65db52d830..f2d3c6e3b8 100644
--- a/rts/Sparks.h
+++ b/rts/Sparks.h
@@ -12,6 +12,7 @@
#if defined(PARALLEL_HASKELL) || defined(THREADED_RTS)
StgClosure * findSpark (Capability *cap);
void initSparkPools (void);
+void freeSparkPool (StgSparkPool *pool);
void markSparkQueue (evac_fn evac);
void createSparkThread (Capability *cap, StgClosure *p);
diff --git a/rts/ThreadLabels.c b/rts/ThreadLabels.c
index 1c89d84508..6919e1ae38 100644
--- a/rts/ThreadLabels.c
+++ b/rts/ThreadLabels.c
@@ -29,6 +29,15 @@ initThreadLabelTable(void)
}
void
+freeThreadLabelTable(void)
+{
+ if (threadLabels != NULL) {
+ freeHashTable(threadLabels, NULL);
+ threadLabels = NULL;
+ }
+}
+
+void
updateThreadLabel(StgWord key, void *data)
{
removeThreadLabel(key);
diff --git a/rts/ThreadLabels.h b/rts/ThreadLabels.h
index eaed22d281..59eb321cb7 100644
--- a/rts/ThreadLabels.h
+++ b/rts/ThreadLabels.h
@@ -12,6 +12,7 @@
#if defined(DEBUG)
void initThreadLabelTable (void);
+void freeThreadLabelTable (void);
void updateThreadLabel (StgWord key, void *data);
void * lookupThreadLabel (StgWord key);
void removeThreadLabel (StgWord key);
diff --git a/rts/sm/Storage.c b/rts/sm/Storage.c
index 1d08a85ae2..6e862f225b 100644
--- a/rts/sm/Storage.c
+++ b/rts/sm/Storage.c
@@ -287,6 +287,7 @@ freeStorage (void)
#if defined(THREADED_RTS)
closeMutex(&sm_mutex);
closeMutex(&atomic_modify_mutvar_mutex);
+ stgFree(nurseries);
#endif
}