Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Test that a Haskell function has a space leak

Tags:

haskell

I'm writing a collection of example space leaks in Haskell, and would like to write a test suite to catch myself in case I insert any examples that don't actually leak space.

Is there way to test the examples without making a separate executable for each one?

like image 346
seagreen Avatar asked Aug 14 '17 00:08

seagreen


Video Answer


1 Answers

You can detect a space-leak with test, but you can't prove an absence of space leaks. Even if memory profile relatively low it may just point that space leak very small and you have not made enough iterations.

To detect space leaks you may use allocation limits and counters as described here May I limit memory usage per function/monad/thread in Haskell?

like image 158
schernichkin Avatar answered Oct 16 '22 11:10

schernichkin