Skip to content

Commit

Permalink
Free various things we allocate
Browse files Browse the repository at this point in the history
  • Loading branch information
igfoo committed Dec 15, 2006
1 parent 80578b7 commit 221e74f
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 1 deletion.
2 changes: 2 additions & 0 deletions rts/Capability.c
Expand Up @@ -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;
}
Expand Down
7 changes: 6 additions & 1 deletion rts/RtsStartup.c
Expand Up @@ -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();

Expand Down
5 changes: 5 additions & 0 deletions rts/Sparks.c
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions rts/Sparks.h
Expand Up @@ -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);

Expand Down
9 changes: 9 additions & 0 deletions rts/ThreadLabels.c
Expand Up @@ -28,6 +28,15 @@ initThreadLabelTable(void)
}
}

void
freeThreadLabelTable(void)
{
if (threadLabels != NULL) {
freeHashTable(threadLabels, NULL);
threadLabels = NULL;
}
}

void
updateThreadLabel(StgWord key, void *data)
{
Expand Down
1 change: 1 addition & 0 deletions rts/ThreadLabels.h
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions rts/sm/Storage.c
Expand Up @@ -287,6 +287,7 @@ freeStorage (void)
#if defined(THREADED_RTS)
closeMutex(&sm_mutex);
closeMutex(&atomic_modify_mutvar_mutex);
stgFree(nurseries);
#endif
}

Expand Down

0 comments on commit 221e74f

Please sign in to comment.