Free more things that we allocate
[ghc-hetmet.git] / rts / Schedule.c
index c61e623..a11a15e 100644 (file)
@@ -1808,6 +1808,9 @@ scheduleHandleThreadFinished (Capability *cap STG_UNUSED, Task *task, StgTSO *t)
     debugTrace(DEBUG_sched, "--++ thread %lu (%s) finished", 
               (unsigned long)t->id, whatNext_strs[t->what_next]);
 
+    /* Inform the Hpc that a thread has finished */
+    hs_hpc_event("Thread Finished",t);
+
 #if defined(GRAN)
       endThread(t, CurrentProc); // clean-up the thread
 #elif defined(PARALLEL_HASKELL)
@@ -2578,6 +2581,8 @@ exitScheduler( void )
        boundTaskExiting(task);
        stopTaskManager();
     }
+#else
+    freeCapability(&MainCapability);
 #endif
 }
 
@@ -2585,6 +2590,9 @@ void
 freeScheduler( void )
 {
     freeTaskManager();
+    if (n_capabilities != 1) {
+        stgFree(capabilities);
+    }
 #if defined(THREADED_RTS)
     closeMutex(&sched_mutex);
 #endif