[Haskell-cafe] possible memory leak in uvector

Manlio Perillo manlio_perillo at libero.it
Tue Mar 3 07:18:21 EST 2009

Duncan Coutts ha scritto:
> On Tue, 2009-03-03 at 02:12 +0100, Manlio Perillo wrote:
>> Hi.
>> In the "help optimizing memory usage for a program" I discovered some 
>> interesting things:
>> 1) Using lazy ByteStrings to read files it not a good choice, since the
>>     garbage collector is not able to proper garbage cleanup.
>>     Running with -F1 RTS flag, however, keeps memory usage down.
> It is certainly possible to have proper garbage cleanup. I can write
> programs using lazy ByteStrings that process many megabytes of data and
> yet run in 1Mb of heap space.
> At first guess it sounds like you're holding onto too much, if not the
> whole stream perhaps bits within each chunk. 

It is possible.

I split the string in lines, then map some functions on each line to 
parse the data, and finally calling toU, for converting to an UArr.

 > [...]

Thanks   Manlio Perillo

More information about the Haskell-Cafe mailing list