[GHC] #7847: Maintain per-generation lists of weak pointers

GHC cvs-ghc at haskell.org
Fri Apr 19 11:51:55 CEST 2013


#7847: Maintain per-generation lists of weak pointers
-----------------------------------------+----------------------------------
Reporter:  akio                          |          Owner:                  
    Type:  feature request               |         Status:  new             
Priority:  normal                        |      Component:  Runtime System  
 Version:  7.7                           |       Keywords:                  
      Os:  Unknown/Multiple              |   Architecture:  Unknown/Multiple
 Failure:  Compile-time performance bug  |      Blockedby:                  
Blocking:                                |        Related:                  
-----------------------------------------+----------------------------------
 Currently the runtime system keeps a list of all live weak pointers, and
 traverses it once every (major or minor) GC. This is very slow if the
 program keeps many weak pointers alive. Some comments in the rts source
 suggest that it should be using one weak pointer list per generation, so
 these patches implement that.

 The attached test program tries to imitate the memory behavior of code
 that uses a particular FRP library. The patches make the program 3x faster
 on my machine.

 One problem I can see with the patches is that it creates a race condition
 between finalizeForeignPtr and addForeignPtrFinalizer. I'm not even sure
 what the correct behavior is when addForeignPtrFinalizer is called after
 finalizerForeinPtr.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7847>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler



More information about the ghc-tickets mailing list