On Thu, 17 Feb 2011, Evan Laforge wrote:
liveliness. The typical memory leak works as follows:
let (prefix, suffix) = splitAt largeNumber xs
in processA prefix ++ processB suffix
Although this can be perfectly processed in a streaming manner, sometimes
GHC does not manage to release the pointer to the beginning of prefix and
thus prefix is kept until the processing of suffix starts. I wonder whether
Just out of curiosity, how do you find out when this is happening?
I notice large leaks when the machine starts swapping intensively. I
detect smaller leaks with 'top'. For even smaller leaks I set a trap using
runtime options for restricting heap memory:
synthi +RTS -M8m -RTS
The program should run with constant memory consumption. If the memory
consumption increases, then the program stops when the heap overflows. But
before that happens often ALSA reports buffer underruns faster and faster,
due to the increasing number of memory pieces that the garbage collector
has to check.
The fastest way to detect a memory leak is certainly not to play the sound
at all, but just write it to disk or /dev/null. Then memory leaks hit a
heap memory restriction very qickly.
_______________________________________________
haskell-art mailing list
haskell-art@lurk.org
http://lists.lurk.org/mailman/listinfo/haskell-art