Verify that the Haskell function has a space leak

I am writing a collection of examples of space leaks in Haskell and would like to write a test suite to catch myself in case I insert any examples that actually do not skip space.

Is there a way to test examples without a separate executable for each of them?

+8
haskell
source share
1 answer

You can detect a space leak with the test, but you cannot prove the absence of space leaks. Even if the memory profile is relatively low, it can simply indicate that the space leak is very small and you haven’t done enough iterations.

To detect space leaks, you can use limits and allocation counters as described here. Is it possible to limit memory usage for each / monad / thread function in Haskell?

+2
source share

All Articles