Joe,

Bad news from the nhc98 camp on your test cases - they don't leak in
the same way!  Bear in mind that different compilers produce code with
different space behaviour - so some of your cases which leak in Hugs
don't leak in nhc98, and vice versa.

    test1a      constant space of ~1kb
    test1b      leaks (spike of 14kb produced by `length')
    test1c      leaks (spike of 19kb produced by `length')

    test2a      leaks (spike of 35kb produced by `deserialise')
    test2b      leaks (spike of 14kb produced by `length')

    test3a      constant space of ~1.8kb
    test3b      constant space of ~1.6kb

    test4a      constant space of ~1.2kb
    test4b      constant space of ~1.3kb

So, attacking the most promising avenue, test2a, with more detailed
tools, we find that the spike consists of

     41% Prelude.:
     41% SpaceLeak.Tree
     14% Prelude.[]

all of which are retained by _apply1 (an internal part of nhc98), and
all of which are Lag, i.e. either created too early before their first
use, or conversely, not used soon enough after their creation.

Compare this with test2b, where the spike produced by `length' consists
of mostly (+) closures, mostly retained by (+) closures, and again all
Lag.  Now clearly this is just the well-known strictness problem with
foldl, so presumably there must be something similar happening in test
2a.  If you can fix that, then report any remaining leaks as bugs in
Hugs or ghc's code generation.  :-)

Regards,
    Malcolm

Reply via email to