C# Garbage Collection Failure
reefedjib at yahoo.com
Mon Nov 19 02:25:46 UTC 2007
----- Original Message -----
From: "Bert Freudenberg" <bert at freudenbergs.de>
To: "The general-purpose Squeak developers list"
<squeak-dev at lists.squeakfoundation.org>
Sent: Sunday, November 18, 2007 5:34 PM
Subject: Re: C# Garbage Collection Failure
> On Nov 19, 2007, at 2:05 , Rob Withers wrote:
>>> From http://www.codeproject.com/showcase/ IfOnlyWedUsedANTSProfiler.asp:
>> "because the objects were still registered as subscribers to an
>> event, they were never getting deleted"
>> Ah, yes. Good thing we use weak references to subscribers.
> You never had to clean up an image that got larger and larger for no
> apparent reason?
I certainly have, as recently as last week, when working with promises and
eventual sending that goes into the weeds. It's not always easy to track
down the source of these things.
However, in the specific case they talk about, objects registered as
subscribers, Squeak uses WeakMessageSends for event registration, so this
isn't a problem. See the implementation of #when:send:to:. When all other
references to a subscriber are dropped, it is GCed ok. Furthermore, the
action sequences clean up themselves whenever there is a new registration:
see #asMinimalRepresentation and it's senders.
More information about the Squeak-dev