summaryrefslogtreecommitdiff
path: root/rts/Task.c
diff options
context:
space:
mode:
authorSimon Marlow <simonmar@microsoft.com>2006-08-08 10:31:10 +0000
committerSimon Marlow <simonmar@microsoft.com>2006-08-08 10:31:10 +0000
commit9f2ceb4da7dfbc1cfd09ce54610ebe64288b9007 (patch)
treec8a72bc8d7e4663c9b5f789d54a6a69bfbba4340 /rts/Task.c
parent3098d2143a5865f8f1fba1d7d72132b140f2de94 (diff)
downloadhaskell-9f2ceb4da7dfbc1cfd09ce54610ebe64288b9007.tar.gz
Remember to free() memory on exit
Patch mostly from Lennart Augustsson in #803, with additions to Task.c by me.
Diffstat (limited to 'rts/Task.c')
-rw-r--r--rts/Task.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/rts/Task.c b/rts/Task.c
index c8cd9c4a2c..ef20c09a6e 100644
--- a/rts/Task.c
+++ b/rts/Task.c
@@ -74,9 +74,19 @@ initTaskManager (void)
void
stopTaskManager (void)
{
+ Task *task, *next;
+
debugTrace(DEBUG_sched,
"stopping task manager, %d tasks still running",
tasksRunning);
+
+ ACQUIRE_LOCK(&sched_mutex);
+ for (task = task_free_list; task != NULL; next) {
+ next = task->next;
+ stgFree(task);
+ }
+ task_free_list = NULL;
+ RELEASE_LOCK(&sched_mutex);
}