[Haskell-cafe] possible memory leak in uvector 0.1.0.3

Manlio Perillo manlio_perillo at libero.it
Mon Mar 2 20:12:44 EST 2009


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.

2) UArr from uvector leaks memory.
    I'm rather sure about this.

    In fact the memory usage of my program is 815 MB, when:
    - I use lazy ByteString with -F1 flag
    or
    - if I use strict ByteString


Using UArray and strict ByteString, memory usage is 660 MB.

In total I have 17770 arrays, so there is a leak of about 9146 bytes per 
array.


In another program, where I do a lot of array concatenations, memory 
leak is much more evident.
Even using -F1 flag, memory usage grows too much.


Is this a know bug?
How can I verify if it is really a memory leak bug?


pumpkin_ (on #haskell.it) suggested me to use a more recent version of 
uvector package, from
http://patch-tag.com/publicrepos/pumpkin-uvector

Using this version memory usage is, finally, 643 MB!
(and execution if a bit faster, too).


The other program, with a lot of array concatenations, still eats a lot 
of memory...



Thanks   Manlio Perillo


More information about the Haskell-Cafe mailing list