[project @ 2002-11-01 11:05:46 by simonmar]
authorsimonmar <unknown>
Fri, 1 Nov 2002 11:05:47 +0000 (11:05 +0000)
committersimonmar <unknown>
Fri, 1 Nov 2002 11:05:47 +0000 (11:05 +0000)
Fix the heapCensus crash.

It turned out that after a GC, the small_alloc_list might be non-empty
if a new finalizer thread had been started.  The last block on
small_alloc_list doesn't have the free pointer set correctly (as a
small optimisation, we don't normally set the free pointer after each
allocation, only when the block is full).  The result was that the
free pointer contains the wrong value, and the heap census traverses
garbage.  The fix is to set the free pointer correctly before
traversing small_alloc_list.

The bug doesn't show up when DEBUG is on, because extra DEBUG checks
cause the free pointer to be initialised to a sensible(-ish) value.
Hence my difficulty in reproducing the bug.

To reproduce: compile ghc-regress/lib/should_run/memo002 with
profiling and run it with a sufficiently small sample interval (-i0.02
did it for me).

Thanks to the kind folks at ARM for helping out with the debugging of
this one.

MERGE TO STABLE


No differences found