[mercury-users] garbage collection and stores

Ralph Becket rafe at cs.mu.OZ.AU
Wed Feb 27 12:12:22 AEDT 2002


Michael Day, Tuesday, 26 February 2002:
> 
> Hi,
> 
> If you put something in a store, can it be garbage collected when the
> mutvars that refer to it have all been collected, or must the store be
> free also? (ie. does the store have an internal reference to the object 
> that would stop it going out of scope when the mutvars disappear).

Like the IO state, a store is just a notional object that enforces a
unique order of evaluation on store related operations.  At the back
end, the store is not represented anywhere: the mutvars are just
pointers into the heap.  Hence once there are no more mutvars pointing
to a stored value, that value can be collected.

> This is probably a redundant question, as io__state can be a store, and
> io__state is generally just optimised away... so a mutvar is just a
> garbage collected pointer?

Yep.

> Looking forward to all kinds of C style programming in Mercury :)

Best of luck :)

- Ralph
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list