Preventing/handling space leaks

Henk-Jan van Tuyl Henk-Jan.van.Tuyl at hotpop.com
Wed Dec 10 15:38:59 EST 2003


L.S.,

On 07 Dec 2003 22:53:45 +0100, <ketil+haskell at ii.uib.no> wrote:

> "Henk-Jan.van.Tuyl" <Henk-Jan.van.Tuyl at hotpop.com> writes:
>
>> L.S.,
>
> (Whom?)

L.S. :: Abbreviation a => Latin a
L.S. = "Lectoribus Salutem" -- Readers be greated

>
>> Does anyone know about documentation (preferably on the Web) on how to
>> prevent/find/remove space leaks?  Are there any differences between
>> Hugs and GHC or any other Haskell platform, regarding space leaks?
>
> I should probably invest the time to learn Hat or Buddha or something,
> but I find I get pretty far using GHCs (mostly adopted from NHC, I
> believe) memory profiling.  Look it up in the (excellent) User Guide!
>
>> Java, for example, does not have [space leaks]
>
> Makes me wonder why my Java-using aquaintances are so frustrated about
> it, then... :-)

I have spent most of the six years with my former employer coding in C and some time in Java (and other languages) and had never any trouble with space leaks; mainly because I strictly followed some rules for Good Coding Practice (never use gotos, only one return statement per function, catch exceptions as early
as possible, keep variables as local as possible, always check the number of free()s, etc. (etc. == etcetera == and so forth :-) ))
So far I have seen only one rule for Good Coding Practice in Haskell: Do Not Use n+k Patterns. I hope someone can give some directions, how to avoid known pitfalls (especially Space Leaks).

-- 
Best regards,
Henk-Jan van Tuyl



More information about the Haskell-Cafe mailing list