ndmitchell / spaceleak

Notes on space leaks

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Experience Report

jberryman opened this issue · comments

Trying out this technique on a large program with many dependencies I found that compiling with profiling seems to distort stack usage too much for the results to be useful. That is following the process here resulted in chasing "leaks" in dependencies where none exist (or at least no high stack usage) in a non-profile build (in my case even one with -O0).

I was using stack ... -profile and frankly don't have a great idea about what flags ghc was passed for my program and its dependencies.

Do you think it would be a good suggestion to first try running an optimized build with K1K and only to undertake this exercise if it fails?

What do you mean by "distort stack usage"? That the stack usage went up because it wasn't optimised? Or that the stack reported was useless?

Given your large program, does running with -K1K work? My experience is that almost never happens, so it wasn't even worth writing as a preparatory step...

Yeah so our test suite ran successfully with -K1K when compiled without profiling, and with -O0, but I didn't even think to test that before experimenting with this technique.

What do you mean by "distort stack usage"?

I just mean that all the stack overflows I experienced and started investigating went away when I stopped compiling with -prof (I think stack rebuilt with -auto-all on all dependencies as well).