ok I was not sure of how much you were aware of how the GC works :)
second try:

In your example it would be enough to cut the connection the ship,
everything "aboard" will be GC'ed as well. 

Once you cut the connection to a subgraph of objects, and they are no
longer reachable from the outside (root objects) the whole subgraph get's 
garbage collected.

In your example: as soon as nobody references a ship anymore it gets garbage 
collected,
as well as all objects that were only reachable via that ship.

clearer? If not I suggest you quickly make your own little example. 
Note that with #allInstances you can see which objects are still around of a 
certain
class, for instance: Dictionary allInstances


On 2013-06-27, at 00:13, Paul DeBruicker <[email protected]> wrote:
> In Pharo2 Object (and many other classes) implement #release and
> #release has many senders.  So I don't understand how 'there is no such
> thing as #release in Pharo'.  I understand that the GC is a VM thing and
> it does not send #release to the objects in the image.
> 
> 
> IF in my hypothetical question the Navy object contains an ordered
> collection of ships, and each ship is referenced in that collection and
> also by all of its soldiers and jobs, to have my ship GC'd do I only
> need to remove the reference to the ship in the Navy object (at which
> point the ship becomes detached and self contained amalgamation of
> soldiers and jobs) or do I have to have each soldier and job dereference
> the ship too?
> 
> 
> 
> 
> On 06/26/2013 03:05 PM, Camillo Bruni wrote:
>> There is no such thing as #release in Pharo. If you want your objects
>> to be garbage collected just make sure to remove all references to it.
>> You simply assign nil to instance variables which previously held such
>> and object.
>> 
>> Does that answer your question?
>> 
>> On 2013-06-26, at 23:47, Paul DeBruicker <[email protected]> wrote:
>>> Lets say I'm modeling a navy that is comprised of many ships each with
>>> their own soldiers and jobs.  If I want one of the ships to be GC'd do I
>>> need to implement #release in the soldier and job objects and send it to
>>> each of those soldiers and jobs that live and work on the ship I want
>>> GC'd or is removing the references between the ship and the navy enough
>>> to have the whole ship (including its soldiers and jobs)  GC'd?
>> 
> 
> 


Reply via email to