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

GHC ghc-devs at haskell.org
Tue Apr 29 11:31:06 UTC 2014


#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


More information about the ghc-tickets mailing list