[Haskell-cafe] Re: Top Level <-

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Sun Sep 7 12:00:46 EDT 2008

On 2008 Sep 7, at 6:23, Ganesh Sittampalam wrote:
> On Sat, 6 Sep 2008, Ashley Yakeley wrote:
>> Ganesh Sittampalam wrote:
>>>>> The set of ACIO expressions exp is the "static initialisers" of  
>>>>> M. The RTS must note when each static initialiser is run, and  
>>>>> cache its result val. Let's call this cache of vals the "static  
>>>>> results cache" of M.
>>>>> When M is loaded, and a static results cache for M already  
>>>>> exists, then it will be used for the vals of M.
>>>> This sounds "reachable" to me, and therefore static overhead and  
>>>> not a leak.
>>> You can call it what you like, but it's still unacceptable  
>>> behaviour, particularly since clients of M will have no way of  
>>> telling from its API that it will happen.
>> That what will happen?
> That memory will be used and not ever be reclaimable.
> Suppose I am writing something that I intend to be used as part of a  
> plug-in that is reloaded in different forms again and again. And I  
> see module K which does something I want, so I use it. It so happens  
> that K uses M, which has a <-. If I knew that using K in my plug-in  
> would cause a memory leak, I would avoid doing so; but since the  
> whole point of <- is to avoid making the need for some state visible  
> in the API.

False, as it's in ACIO and therefore advertises that it will "leak  
memory" in the name of correct behavior.  Since you consider memory  
leaks to be worse than correct behavior, you can avoid anything that  
uses ACIO.  (But you might want to go look at that list of modules  
which do global variable initialization and therefore aren't entirely  
trustworthy unless something like ACIO exists.)

brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH

More information about the Haskell-Cafe mailing list