I'm trying to debug a program that uses too much memory. I've got the profiling running and use the run time options -s -p -h -xt
. Then I use hp2ps
to plot the resulting .hp
file:
However the actual memory usage is somewhere around 650 Mb (the program is running in a docker container and I see this using docker stats
.
The -s
option gives me this output, which confirms the 650 Mb:
157,666,975,520 bytes allocated in the heap
311,897,256 bytes copied during GC
202,383,488 bytes maximum residency (609 sample(s))
64,558,856 bytes maximum slop
635 MB total memory in use (200 MB lost due to fragmentation)
Tot time (elapsed) Avg pause Max pause
Gen 0 301713 colls, 0 par 1.932s 1.803s 0.0000s 0.0022s
Gen 1 609 colls, 0 par 2.743s 2.694s 0.0044s 0.0104s
TASKS: 5 (1 bound, 4 peak workers (4 total), using -N1)
SPARKS: 0 (0 converted, 0 overflowed, 0 dud, 0 GC'd, 0 fizzled)
INIT time 0.001s ( 0.001s elapsed)
MUT time 64.448s ( 84.663s elapsed)
GC time 4.499s ( 4.320s elapsed)
RP time 0.000s ( 0.000s elapsed)
PROF time 0.176s ( 0.177s elapsed)
EXIT time 0.001s ( 0.001s elapsed)
Total time 69.137s ( 88.985s elapsed)
Alloc rate 2,446,431,692 bytes per MUT second
Productivity 93.2% of total user, 72.4% of total elapsed
gc_alloc_block_sync: 0
whitehole_spin: 0
gen[0].sync: 0
gen[1].sync: 0
Reading this post it seems like a similar problem was resolved using the options -xt -hy
, but that didn't work for me (and gave me even less information in the plot). I've also tried solutions suggested in this, this and this question.
I suspect that a function using ByteString
is responsible because it uses pinned memory:
Any ideas?