[Haskell-cafe] announce: Glome.hs raytracer (memory leak with parMap)

Jim Snow jsnow at cs.pdx.edu
Thu Mar 27 14:58:36 EDT 2008


pepe wrote:
>
> On 27/03/2008, at 3:49, Ian Lynagh wrote:
>> On Wed, Mar 26, 2008 at 02:33:20PM -0700, Jim Snow wrote:
>>>
>>> -Memory consumption is atrocious: 146 megs to render a scene that's a
>>> 33k ascii file.  Where does it all go?  A heap profile reports the max
>>> heap size at a rather more reasonable 500k or so.  (My architecture is
>>> 64 bit ubuntu on a dual-core amd.)
>>
>> I haven't looked properly yet, but it looks like something is leaking
>> memory that shouldn't be. The attached Gloom.hs uses constant memory,
>> but if you replace the "map" with the commented out "(parMap rnf)" then
>> the memory use seems to keep increasing, even once it has run display
>> once and is running it a second or third time.
>>
>
> In my system the leak only appears with +RTS -N1 (which is the default).
> If I use -N2 or higher, then your version runs in constant memory with 
> (parmap rnf).
>
> Cheers
> pepe
Using Ian Lynagh's Gloom.hs (I'm not sure if that's a typo, but it's a 
convenient way to distinguish it
from my original Glome.hs):

With parMap and +RTS -N2, I get 59 megs total mapped memory, 18 megs 
resident all three iterations.
With parMap and +RTS -N1, I get 53/21, then 99/66, then 145/112 megs 
total/resident.
With map and no RTS options, memory use is 37/4.8 all three iterations.

I'm using ghc 6.8.2 on 64-bit ubuntu.

-jim


More information about the Haskell-Cafe mailing list