Opened 11 years ago

Closed 9 years ago

#2185 closed bug (fixed)

Memory leak with parMap

Reported by: igloo Owned by: simonmar
Priority: high Milestone: 7.0.1
Component: Runtime System Version: 6.8.2
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Runtime performance bug Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

With the attached All.hs, if you run the program without any arguments (so that it uses parMap rnf in gen_blocks_list) then its memory usage keeps going up, even though at the top level it's just running the same computation 5 times in a row. Memory usage goes up to over 100M.

If you give an argument (any argument, so that it uses map instead) then memory usage is constant and only a few megs.

Happens in 6.8.2 and the HEAD.

Attachments (1)

All.hs (4.8 KB) - added by igloo 11 years ago.

Download all attachments as: .zip

Change History (11)

Changed 11 years ago by igloo

Attachment: All.hs added

comment:1 Changed 11 years ago by igloo

Forgot to say: Compiling with

ghc -Wall -fforce-recomp All.hs --make -fasm -O2 -threaded -fglasgow-exts -funbox-strict-fields -fbang-patterns -debug

I haven't experimented with other flags.

comment:2 Changed 11 years ago by simonmar

Milestone: 6.8.36.10 branch
Owner: set to simonmar

I think sparks are currently treated as roots by the GC, which is wrong. I won't get around to fixing this in 6.8.3, but I'll do it in the new GC code in 6.10.

comment:3 Changed 11 years ago by simonmar

Resolution: fixed
Status: newclosed

Now fixed, and I've added the program to our test suite.

comment:4 Changed 11 years ago by simonmar

Component: CompilerRuntime System
Resolution: fixed
Status: closedreopened

unfixed. Sparks really should be treated as GC roots, because many uses of par rely on this behaviour (including most of the strategies library).

I don't have any ideas for how to fix this yet.

comment:5 Changed 11 years ago by simonmar

Architecture: UnknownUnknown/Multiple

comment:6 Changed 11 years ago by simonmar

Operating System: UnknownUnknown/Multiple

comment:7 Changed 10 years ago by igloo

Milestone: 6.10 branch6.12 branch

comment:8 Changed 10 years ago by simonmar

Type of failure: Runtime performance bug

comment:9 Changed 9 years ago by simonmar

difficulty: UnknownModerate (less than a day)
Milestone: 6.12 branch6.14.1
Priority: normalhigh

The new parallel package on Hackage fixes the space leak in this program (change rnf to rdeepseq to compile it). I'm leaving the ticket open and moving it onto the 6.14.1 branch, because we still need to change the GC policy so that sparks are not treated as GC roots.

comment:10 Changed 9 years ago by simonmar

Resolution: fixed
Status: newclosed

Fixed:

Tue May 25 08:04:35 PDT 2010  Simon Marlow <marlowsd@gmail.com>
  * Make sparks into weak pointers (#2185)
  The new strategies library (parallel-2.0+, preferably 2.2+) is now
  required for parallel programming, otherwise parallelism will be lost.
Note: See TracTickets for help on using tickets.