[Haskell-cafe] Debugging misbehaving multi-threaded programs

Evan Klitzke evan at eklitzke.org
Thu Jun 11 23:17:38 EDT 2009

On Thu, Jun 11, 2009 at 12:40 AM, Ketil Malde<ketil at malde.org> wrote:
> Evan Klitzke <evan at eklitzke.org> writes:
>> [...] Unfortunately, this doesn't seem to work; whenever the
>> program terminates due to running out of heap space, the generated
>> .prof file is empty.
> Unless there's some specific problem with profiling in combination
> with threading, you can get heap profiling from a crashing program.
> Not what you wanted, but you might at least be able to see what is
> allocated.

After fiddling around a bit, I found out that you can get a heap
profile from a program that dies from an error, but not one that dies
from actually running out of heap space. I was able to take advantage
of this by making the main thread do a threadDelay and then error,
with the threadDelay timed to occur during the program's misbehavior.

Evan Klitzke <evan at eklitzke.org> :wq

More information about the Haskell-Cafe mailing list