Commit 221e74f6 authored by Ian Lynagh's avatar Ian Lynagh
Browse files

Free various things we allocate

parent 80578b7d
......@@ -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;
}
......
......@@ -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();
......
......@@ -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
......
......@@ -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);
......
......@@ -28,6 +28,15 @@ initThreadLabelTable(void)
}
}
void
freeThreadLabelTable(void)
{
if (threadLabels != NULL) {
freeHashTable(threadLabels, NULL);
threadLabels = NULL;
}
}
void
updateThreadLabel(StgWord key, void *data)
{
......
......@@ -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);
......
......@@ -287,6 +287,7 @@ freeStorage (void)
#if defined(THREADED_RTS)
closeMutex(&sm_mutex);
closeMutex(&atomic_modify_mutvar_mutex);
stgFree(nurseries);
#endif
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment