#881: Improve space profiling for references
--------------------------------+-------------------------------------------
    Reporter:  simonpj          |        Owner:         
        Type:  feature request  |       Status:  new    
    Priority:  normal           |    Milestone:         
   Component:  Profiling        |      Version:  6.4.2  
    Severity:  normal           |     Keywords:         
          Os:  Unknown          |   Difficulty:  Unknown
Architecture:  Unknown          |  
--------------------------------+-------------------------------------------
GHC's great space profiling tools don't appear to be much help when your
 leaked memory is stored in references (IORefs, StablePtrs, etc).  I had
 a real-life case where the allocation profile showed me where the leaked
 data came from, and I could guess that it was being held by some
 reference, but I couldn't tell which one.  Retainer set profiling showed
 a big suspicious entry for "SYSTEM", but I couldn't find any way to
 pinpoint the problem.  (It ended up being a missing freeStablePtr in
 hsgnutls, found by code inspection.)

 Here's a contrived example that just allocates a bunch of IORefs:
 {{{
     import Control.Monad
     import Data.IORef

     main = repeatM (newIORef [1,2,3])
     repeatM io = liftM2 (:) io (repeatM io)
 }}}
 Retainer set profiling shows everything in "SYSTEM".  None of the other
 profiling methods say anything interesting either.  What I'd like to
 get, I think, is (1) your memory is being held in IORefs (2) allocated
 by this cost center and (3) being retained by this cost center.  I guess
 I'm looking for something like a memory profiler for a traditional
 language.

 Andrew Pimlott

 Simon Marlow comments: "The relevant predicate "is retainer" is pretty
 much built into the retainer profiler, and it returns true only for thunks
 if I recall correctly.  Being able to tweak this, or maybe just install a
 better default would be an improvement.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/881>
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

Reply via email to