[Haskell-cafe] preventing space leaks?

Baojun Wang wangbj at gmail.com
Fri Sep 19 08:00:19 UTC 2014


Hi Cafe,

I'm very new to Haskell, and I'm confused about haskell space leaks, even I
read some wiki pages from haskell.org. Below is the scenario I''m facing at:

When I use listArray to create either IArray or UArray, I found it could
lead to space leaks (very high GC time), is there a way to prevent this,
and why there is no fusion when create IArray/UArray from the list? I don't
need the list anyway after array is created. (I used this few times for DP,
based on this link: http://jelv.is/blog/Lazy-Dynamic-Programming/).

Further more, suppose if I create a IArray A from list 1, later I create
UArray B based some computations based on A (also I need discard another
list 2). After B is generated, I don't need A anymore (so this lead to
space leaks, correct)?

Another quetion, by the way, after the lazy IArray is created (say from a
DP), is there a way convert it to UArray for better performance (IArray ->
UArray)?

How can I improve the space leak problems with above use case?

Best Regards
Baojun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140919/f99e5f43/attachment.html>


More information about the Haskell-Cafe mailing list