[Haskell-cafe] uvector package appendU: memory leak?

Manlio Perillo manlio_perillo at libero.it
Sun Mar 29 16:56:15 EDT 2009


Manlio Perillo ha scritto:
> Hi.
> 
> As with a previous post, I think I have found a possible memory problem 
> with the uvector package.
> 
> I have this data structure (for, again, my Netflix Prize project):
> 
>     IntMap (UArr (Word16 :*: Word8))
> 
> [...]
>
> Today I have rewritten my program to use `alter` and `snocU`:
> 
>     append Nothing = Just $ singletonU (a :*: b)
>     append (Just u) = Just $ snocU u (a :*: b)
> 
>     alter append k m
 >
 > [...]
 >
> Unfortunately I'm still not able to load the entire Netflix Prize 
> training data set, grouping ratings by customers, because my PC has only 
> 2 GB of RAM.
> The required memory is about 2 GB, but when the system start to swap, I 
> have to kill the program.
> 

Just another small strictness hint:

     append (Just u) = u `seq` Just $ snocU u (a :*: b)

and now memory usage is 955 MB.


Regards  Manlio


More information about the Haskell-Cafe mailing list