Hello, i was looking at various method and classes but i didn't find anything interesting about this question. Is there a way to catch GC when deleting an object? Something like a method calling before deleting it...
Byte.
look for finalize
Object>>finalize "Finalize the resource associated with the receiver. This message should only be sent during the finalization process. There is NO garantuee that the resource associated with the receiver hasn't been free'd before so take care that you don't run into trouble - this all may happen with interrupt priority."
On 1 juin 06, at 21:26, Bruno Luca wrote:
Hello, i was looking at various method and classes but i didn't find anything interesting about this question. Is there a way to catch GC when deleting an object? Something like a method calling before deleting it...
Byte.
-- www.lethalman.net - Thoughts about computer technologies
On Thu, 01 Jun 2006 21:55:29 +0200, stéphane ducasse ducasse@iam.unibe.ch wrote:
look for finalize
Object>>finalize "Finalize the resource associated with the receiver. This message should only be sent during the finalization process. There is NO garantuee that the resource associated with the receiver hasn't been free'd before so take care that you don't run into trouble - this all may happen with interrupt priority."
Thanks this time too man :)
Look in the archives for weak references and finalization.
On finalization a shadow copy of your object is sent a finalization method after the real object has been GCed. Other smalltalks provide a number of solutions up to including sending a message to your object saying it's going to be GCed and asking if it should be resurrected. (not a squeak solution).
Normally this logic is used to close system resources, say operating system file handles.
see StandardFileStream>>actAsExecutor
finalize
StandardFileStream class>>register: unregister: registry
for clues.
On 1-Jun-06, at 12:26 PM, Bruno Luca wrote:
Hello, i was looking at various method and classes but i didn't find anything interesting about this question. Is there a way to catch GC when deleting an object? Something like a method calling before deleting it...
Byte.
-- www.lethalman.net - Thoughts about computer technologies
-- ======================================================================== === John M. McIntosh johnmci@smalltalkconsulting.com 1-800-477-2659 Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com ======================================================================== ===
squeak-dev@lists.squeakfoundation.org