#2762: Excessive heap usage
---------------------------------+------------------------------------------
    Reporter:  igloo             |        Owner:                  
        Type:  bug               |       Status:  new             
    Priority:  normal            |    Milestone:  6.10.2          
   Component:  Compiler          |      Version:  6.11            
    Severity:  normal            |   Resolution:                  
    Keywords:                    |   Difficulty:  Unknown         
    Testcase:                    |           Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |  
---------------------------------+------------------------------------------
Changes (by simonpj):

 * cc: [EMAIL PROTECTED] (added)

Comment:

 What we need here is a decent arity analysis, which Max is thinking about.
 We have
 {{{
   f = \d. let f1 = f d in
            \y. ...f1...
 }}}
 The leak comes from a shared partial application of `f`:
 {{{
   let t = f d in (t e1, t e2)
 or
   map (f d) es
 }}}
 This is readily fixed.  `f` ''looks'' as if it has arity 1, but a simple
 fixpoint argument shows that it really has arity 2.  When we see that, we
 see that we can eta-expand it to get
 {{{
   f = \d.\x.  let f1 = f d in ...f1 d...
 }}}
 Now we can inline `f1`, and all is good.

 I had not previously realised that this arity analysis stuff could fix
 space leaks.

 Simon

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