Am 27.06.2013 um 01:07 schrieb Paul DeBruicker <pdebr...@gmail.com>:
> Sven & Camillo, > > Ok thanks. And using the PointerFinder is there a way to know which of > the pointers points to the SystemDictionary or Object someObject or > whereever the GC begins so one would not have to check every pointer for > every stubborn object. > > E.g. Lets say I've nil'ed the reference between the Navy and the ship so > its ready to go but a few of the soldiers on the ship have references to > other ships because their transfer papers weren't processed properly. > Running #pointersTo on those soldiers gives a large collection of > pointers. > > > How can I use the computer to filter that list to just those references > back to the root object? > One by one. You only get the list of objects holding a pointer to the object in question. Having those objects you would need to search for pointers other objects have to them. While trying to analyze the situation it might be a good idea to do a "Smalltalk garbageCollect" in between to get rid of the objects that aren't connected but haven't garbage collected yet. Norbert > > > Thanks for you help > > Paul > > On 06/26/2013 03:37 PM, Sven Van Caekenberghe wrote: >> Paul, >> >> On 26 Jun 2013, at 23:47, Paul DeBruicker <pdebr...@gmail.com> 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? >> >> GC is automatic memory management. Whenever something is no longer reachable >> by following pointers from a a know starting set, the system dictionary, the >> stack and some other places, it automatically becomes garbage and the memory >> it occupies will be reused. >> >> Of course, if you keep a reference to an object, on purpose or by accident, >> the object will never become garbage and it will keep on occupying memory. >> Especially circular references can be hard to track. >> >> There are indeed a couple of common messages that are sometimes used to >> break possible references by nilling out instance variables etc. #close, >> #stop, #unregister and indeed #release. Often, these are also used to manage >> external resources (open files, sockets …). You can use any message to do >> this, there is no framework that you have to follow. >> >> And then there are also finalization and weak references, which are related, >> but more advanced. >> >> Sven >> > >