Ganesh Sittampalam wrote:
But it's limited to the initialisers. An IORef holding an Integer isn't much memory, and it only ever gets leaked once.

It happens every time you load and unload, surely?

No. An initialiser is only ever run once per run of the RTS.

Also I thought this was a general discussion with Data.Unique as a concrete example; something else might leak substantially more memory. Your witnesses stuff would leak one Integer per module, wouldn't it?

It would leak one Integer per IOWitness initialiser for the run of the RTS.

Finally, any memory leak at all can be unacceptable in some contexts. It's certainly not something we should just dismiss as "oh, it's only small".

Since it's of the order of the number of uniquely identified initialisers, it's arguably not a memory leak so much as a static overhead. The only way to get a continuous leak is to load and unload an endless stream of _different_ modules, each with their own initialisers.

--
Ashley Yakeley
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to