logo       

Space leak: msg#00155

lang.haskell.glasgow.bugs

Subject: Space leak

Chris Kuklewicz wrote:
Greg Buchholz wrote:
True. But there are some tests like "fasta" that appear to have a
laziness induced space leak that presumably could be fixed.
http://shootout.alioth.debian.org/benchmark.php?test=fasta&lang=all

Already the following bit exhibits unexpected memory consumption:

main = mapM_ print $ take (n * 5) $ drop (n * 3) [1..]
n = 100000

Dropping the elements is more expensive than printing them. Somehow the dropped elements are kept in memory.

With profiling (compiled with -prof -auto-all and called with +RTS -p) the memory consumption is not reported, at least the "total alloc" bytes are not much different with and without the "$ drop (n * 3)" part.

Only my /usr/bin/time -v shows:

Minor (reclaiming a frame) page faults: 4745

for the code above (compiled with optimization) and about ten times less without drop.

Cheers Christian


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise