Commit 8a3574d5 authored by Simon Marlow's avatar Simon Marlow
Browse files

check black holes before doing GC in scheduleDoHeapProfile()

fixes #687, see comment for details.
parent dde3de8c
...@@ -1869,8 +1869,19 @@ scheduleDoHeapProfile( rtsBool ready_to_gc STG_UNUSED ) ...@@ -1869,8 +1869,19 @@ scheduleDoHeapProfile( rtsBool ready_to_gc STG_UNUSED )
if (performHeapProfile || if (performHeapProfile ||
(RtsFlags.ProfFlags.profileInterval==0 && (RtsFlags.ProfFlags.profileInterval==0 &&
RtsFlags.ProfFlags.doHeapProfile && ready_to_gc)) { RtsFlags.ProfFlags.doHeapProfile && ready_to_gc)) {
// checking black holes is necessary before GC, otherwise
// there may be threads that are unreachable except by the
// blackhole queue, which the GC will consider to be
// deadlocked.
scheduleCheckBlackHoles(&MainCapability);
IF_DEBUG(scheduler, sched_belch("garbage collecting before heap census"));
GarbageCollect(GetRoots, rtsTrue); GarbageCollect(GetRoots, rtsTrue);
IF_DEBUG(scheduler, sched_belch("performing heap census"));
heapCensus(); heapCensus();
performHeapProfile = rtsFalse; performHeapProfile = rtsFalse;
return rtsTrue; // true <=> we already GC'd return rtsTrue; // true <=> we already GC'd
} }
......
Markdown is supported
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