#5897: GHC runtime task workers are not released with C FFI
-------------------------------+--------------------------------------------
Reporter: sanketr | Owner:
Type: bug | Status: new
Priority: highest | Milestone: 7.4.2
Component: Runtime System | Version: 7.4.1
Resolution: | Keywords: worker, ffi
Os: Unknown/Multiple | Architecture: x86_64 (amd64)
Failure: None/Unknown | Difficulty: Unknown
Testcase: | Blockedby:
Blocking: | Related: #4262
-------------------------------+--------------------------------------------
Comment(by marlowsd@…):
commit 085c7fe5d4ea6e7b59f944d46ecfeba3755a315b
{{{
Author: Simon Marlow <[email protected]>
Date: Fri Mar 2 10:53:34 2012 +0000
Drop the per-task timing stats, give a summary only (#5897)
We were keeping around the Task struct (216 bytes) for every worker we
ever created, even though we only keep a maximum of 6 workers per
Capability. These Task structs accumulate and cause a space leak in
programs that do lots of safe FFI calls; this patch frees the Task
struct as soon as a worker exits.
One reason we were keeping the Task structs around is because we print
out per-Task timing stats in +RTS -s, but that isn't terribly useful.
What is sometimes useful is knowing how *many* Tasks there were. So
now I'm printing a single-line summary, this is for the program in
TASKS: 2001 (1 bound, 31 peak workers (2000 total), using -N1)
So although we created 2k tasks overall, there were only 31 workers
active at any one time (which is exactly what we expect: the program
makes 30 safe FFI calls concurrently).
This also gives an indication of how many capabilities were being
used, which is handy if you use +RTS -N without an explicit number.
rts/RtsMain.c | 3 +-
rts/Stats.c | 42 +++++++++-----------
rts/Task.c | 100
++++++++++++++++++++++---------------------------
rts/Task.h | 30 +++-----------
rts/posix/OSThreads.c | 1 -
rts/sm/Compact.c | 2 +-
6 files changed, 73 insertions(+), 105 deletions(-)
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5897#comment:11>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs