[GHC] #9520: Running an action twice uses much more memory than running it once

GHC ghc-devs at haskell.org
Thu Aug 28 14:08:05 UTC 2014


#9520: Running an action twice uses much more memory than running it once
-------------------------------------+-------------------------------------
              Reporter:  snoyberg    |            Owner:
                  Type:  bug         |           Status:  new
              Priority:  normal      |        Milestone:
             Component:  Compiler    |          Version:  7.8.3
            Resolution:              |         Keywords:
      Operating System:  Linux       |     Architecture:  x86_64 (amd64)
       Type of failure:  Runtime     |       Difficulty:  Unknown
  performance bug                    |       Blocked By:
             Test Case:              |  Related Tickets:
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------

Comment (by snoyberg):

 > So if `main6` generates a big data structure, it will be retained across
 both calls.

 Well, that's sort of the idea: conduit is essentially a free monad, and
 it's evaluated by interpreting steps like "wait for next input" or
 "provide next value." What *should* be happening is that it creates a
 value indicating the next step, and that value is immediately consumed and
 garbage collected. Instead, for some reason it's maintaining this
 structure between multiple calls, even though the two data structures will
 not match (not that the `Handle` used by each loop will be different).

 Hopefully the base-only version of the code will demonstrate the issue
 more clearly.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9520#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list