When you want to garbage collect a certain instance, what message can you send it?
I'm hacking away at a Seaside based app, and a lot of things ca go haywire, including my RootComponent having 10 instances (is this normal), and I'd like a fresh start (not a fresh image)
Later edit: After reading a bit, apparently the question is anathema in the Automatically Garbage Collected world, so let me rephrase.
There is no way to make the VM garbage collect a specific object. You can evaluate Smalltalk garbageCollect.
to force garbage collection but that will simply trigger the garbage collection mechanism of the VM for all objects.
There are usually two problems here (in my experience):
Smalltalk garbageCollect.
might thus not be sufficient to actually remove the object. You will often see code like 3 timesRepeat: [ Smalltalk garbageCollect ].
which tries to ensure that an object gets collected. Note also that some special objects are protected from garbage collection (like nil
, true
, false
etc.).With that said, we've been using Seaside for close to a decade now and garbage collection is usually one of our least concerns. When we need something garbage collected / cleaned up, nilling the variables and forcing garbage collection (3 times) does the trick.
In Seaside 2.8 you can evaluate WARegistry clearAllHandlers.
, in Seaside 3 that is roughly equivalent to WAAdmin clearAll.
. These statements will clean up active and expired sessions and trash most of the stuff you might be concerned about.
Note: #clearAll
will also clear configurations and registered entry points. Use #clearSessions
if you only want to reset the sessions. Use #clearAll
if you require a more thorough clean up.
Use myObject pointersTo.
to find all the pointers pointing to a particular object. You can also right click on an entry in the GTInspector and click on "open pointers to".
You might also want to check out PointerDetective, which tries to graphically represent the pointer finding process.