[GHC] #9052: Support a "stable heap" which doesn't get garbage collected

#9052: Support a "stable heap" which doesn't get garbage collected ----------------------------------------------+---------------------------- Reporter: ezyang | Owner: Type: feature request | simonmar Priority: normal | Status: new Component: Runtime System | Milestone: Keywords: | Version: 7.9 Architecture: Unknown/Multiple | Operating System: Difficulty: Moderate (less than a day) | Unknown/Multiple Blocked By: | Type of failure: Related Tickets: | None/Unknown | Test Case: | Blocking: ----------------------------------------------+---------------------------- Simon Marlow was explaining the concept on IRC. The problem we're trying to solve is you might have some very long-lived pointer data-structures, and you don't want to waste time traversing this structure on a major GC when you know that it is still going to be alive. Here's the basic idea: 1. We have a new generation on the heap called the 'stable heap' (along- side the nursery, gen0, gen1, etc). By default, no objects are automatically promoted from the old gen to the stable heap. 2. A user can request an object be moved to the stable heap, creating a stable pointer which points to the object. 3. During garbage collection, all blocks in the stable heap are always considered reachable. We don't include the stable pointers in the root set (so we don't trace the stable heap), however, write barriers are processed as usual, and we promote any objects pointed to by the stable heap to the stable heap. 4. Users manually request the stable heap to be garbage-collected, usually after deallocating stable pointers. In short, the stable heap is just another generation, but one which (1) is only collected by user request, and (2) never receives objects from automatic promotion. This project fits in very nicely with the existing GC infrastructure, so if you understand how everything is laid out this should be reasonably easy to implement. Could be a good ticket for someone who wants to get their hands dirty with the GC. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9052 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9052: Support a "stable heap" which doesn't get garbage collected ----------------------------+---------------------------------------------- Reporter: ezyang | Owner: simonmar Type: feature | Status: new request | Milestone: Priority: normal | Version: 7.9 Component: Runtime | Keywords: System | Architecture: Unknown/Multiple Resolution: | Difficulty: Moderate (less than a day) Operating System: | Blocked By: Unknown/Multiple | Related Tickets: Type of failure: | None/Unknown | Test Case: | Blocking: | ----------------------------+---------------------------------------------- Comment (by carter): This would be very handy for some of my own workloads. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9052#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9052: Support a "stable heap" which doesn't get garbage collected ----------------------------+---------------------------------------------- Reporter: ezyang | Owner: simonmar Type: feature | Status: new request | Milestone: Priority: normal | Version: 7.9 Component: Runtime | Keywords: System | Architecture: Unknown/Multiple Resolution: | Difficulty: Moderate (less than a day) Operating System: | Blocked By: Unknown/Multiple | Related Tickets: Type of failure: | None/Unknown | Test Case: | Blocking: | ----------------------------+---------------------------------------------- Changes (by hvr): * cc: hvr (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9052#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9052: Support a "stable heap" which doesn't get garbage collected ----------------------------+---------------------------------------------- Reporter: ezyang | Owner: simonmar Type: feature | Status: new request | Milestone: Priority: normal | Version: 7.9 Component: Runtime | Keywords: System | Architecture: Unknown/Multiple Resolution: | Difficulty: Moderate (less than a day) Operating System: | Blocked By: Unknown/Multiple | Related Tickets: Type of failure: | None/Unknown | Test Case: | Blocking: | ----------------------------+---------------------------------------------- Comment (by ezyang): A little musing about implementation: we could go about representing the stable generation in two ways. One is that the stable generation is an extra generation which is always present (e.g. we always allocate a field for it when initializing the storage manager), but the GC ignores it; the other is the stable generation is "just another generation" (i.e. to have g0, g1 and a stable gen, the user needs to pass -G3) but specially flagged to behave differently. I think the first option is more user-friendly, but the latter option makes for cleaner implementation, because we don't have to +1 the value of the 'generations' configuration flag. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9052#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9052: Support a "stable heap" which doesn't get garbage collected -------------------------------------+------------------------------------- Reporter: ezyang | Owner: simonmar Type: feature request | Status: new Priority: normal | Milestone: Component: Runtime System | Version: 7.9 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1264 Wiki Page: | -------------------------------------+------------------------------------- Changes (by ezyang): * differential: => Phab:D1264 Comment: We wrote a paper about this! http://ezyang.com/compact.html -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9052#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9052: Support a "stable heap" which doesn't get garbage collected -------------------------------------+------------------------------------- Reporter: ezyang | Owner: simonmar Type: feature request | Status: new Priority: normal | Milestone: Component: Runtime System | Version: 7.9 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1264 Wiki Page: | -------------------------------------+------------------------------------- Comment (by heisenbug): Isn't this implemented now? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9052#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9052: Support a "stable heap" which doesn't get garbage collected -------------------------------------+------------------------------------- Reporter: ezyang | Owner: simonmar Type: feature request | Status: closed Priority: normal | Milestone: Component: Runtime System | Version: 7.9 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1264 Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonmar): * status: new => closed * resolution: => fixed -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9052#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC