continue;
}
debugTrace(DEBUG_sched, "capability %d is stopped.", cap->no);
- stgFree(cap->mut_lists);
- freeSparkPool(&cap->r.rSparks);
+ freeCapability(cap);
RELEASE_LOCK(&cap->lock);
break;
}
#endif /* THREADED_RTS */
+void
+freeCapability (Capability *cap) {
+ stgFree(cap->mut_lists);
+#if defined(THREADED_RTS) || defined(PARALLEL_HASKELL)
+ freeSparkPool(&cap->r.rSparks);
+#endif
+}
#endif /* !THREADED_RTS */
+// Free a capability on exit
+void freeCapability (Capability *cap);
+
/* -----------------------------------------------------------------------------
* INLINE functions... private below here
* -------------------------------------------------------------------------- */
census->drag_total = 0;
}
+STATIC_INLINE void
+freeEra(Census *census)
+{
+ arenaFree(census->arena);
+ freeHashTable(census->hash, NULL);
+}
+
/* --------------------------------------------------------------------------
* Increases era by 1 and initialize census[era].
* Reallocates gi[] and increases its size if needed.
{
}
+void freeProfiling1( void )
+{
+}
+
void initProfiling2( void )
{
if (RtsFlags.ProfFlags.doHeapProfile) {
}
#endif
+ {
+ nat t;
+ for (t = 0; t <= era; t++) {
+ freeEra( &censuses[t] );
+ }
+ }
+ stgFree(censuses);
+
seconds = mut_user_time();
printSample(rtsTrue, seconds);
printSample(rtsFalse, seconds);
}
void
+freeProfiling1 (void)
+{
+ arenaFree(prof_arena);
+}
+
+void
initProfiling2 (void)
{
CostCentreStack *ccs, *next;
#if defined(PROFILING) || defined(DEBUG)
void initProfiling1 ( void );
+void freeProfiling1 ( void );
void initProfiling2 ( void );
void endProfiling ( void );
*/
extern void initDefaultHandlers(void);
+extern void freeSignalHandlers(void);
+
/*
* Function: blockUserSignals()
*
/* start timing the shutdown */
stat_startExit();
+#if defined(RTS_USER_SIGNALS)
+ freeSignalHandlers();
+#endif
+
#if defined(THREADED_RTS)
ioManagerDie();
#endif
/* free the stable pointer table */
exitStablePtrTable();
+#if defined(PROFILING) || defined(DEBUG)
+ freeProfiling1();
+#endif
+
#if defined(DEBUG)
/* free the thread label table */
freeThreadLabelTable();
boundTaskExiting(task);
stopTaskManager();
}
+#else
+ freeCapability(&MainCapability);
#endif
}
freeScheduler( void )
{
freeTaskManager();
+ if (n_capabilities != 1) {
+ stgFree(capabilities);
+ }
#if defined(THREADED_RTS)
closeMutex(&sched_mutex);
#endif
#endif
}
+void
+freeSignalHandlers(void) {
+ if (signal_handlers != NULL) {
+ stgFree(signal_handlers);
+ }
+}
+
#endif /* RTS_USER_SIGNALS */
return;
}
+void
+freeSignalHandlers(void) {
+ /* Do nothing */
+}
+
/* Seems to be a bit of an orphan...where used? */
void
finiUserSignals(void)