Notification on GC of an object?
Hi all, does anybody here have experience with hooking into the GC mechanism so that an object gets notified when it is collected? I have a setup here with auto generated classes that I would like to remove when their unique instance disappears. So Iâd like to let the GC figure out all the complicated tracking and inform me whenever such an object is collected, then Iâll zap the class as well. Experience reports, hints and tips are most welcome! ---> Save our in-boxes! http://emailcharter.org <--- Johan Fabry - http://pleiad.cl/~jfabry PLEIAD lab - Computer Science Department (DCC) - University of Chile
Object>>#finalize ?
On 13 Jan 2015, at 15:13, Johan Fabry <jfabry@dcc.uchile.cl> wrote:
Hi all,
does anybody here have experience with hooking into the GC mechanism so that an object gets notified when it is collected? I have a setup here with auto generated classes that I would like to remove when their unique instance disappears. So Iâd like to let the GC figure out all the complicated tracking and inform me whenever such an object is collected, then Iâll zap the class as well.
Experience reports, hints and tips are most welcome!
---> Save our in-boxes! http://emailcharter.org <---
Johan Fabry - http://pleiad.cl/~jfabry PLEIAD lab - Computer Science Department (DCC) - University of Chile
No, just putting the cleanup code in a finalize method does not seem to be working, sadly.
On Jan 13, 2015, at 11:18, Sven Van Caekenberghe <sven@stfx.eu> wrote:
Object>>#finalize ?
On 13 Jan 2015, at 15:13, Johan Fabry <jfabry@dcc.uchile.cl> wrote:
Hi all,
does anybody here have experience with hooking into the GC mechanism so that an object gets notified when it is collected? I have a setup here with auto generated classes that I would like to remove when their unique instance disappears. So Iâd like to let the GC figure out all the complicated tracking and inform me whenever such an object is collected, then Iâll zap the class as well.
Experience reports, hints and tips are most welcome!
---> Save our in-boxes! http://emailcharter.org <---
Johan Fabry - http://pleiad.cl/~jfabry PLEIAD lab - Computer Science Department (DCC) - University of Chile
---> Save our in-boxes! http://emailcharter.org <--- Johan Fabry - http://pleiad.cl/~jfabry PLEIAD lab - Computer Science Department (DCC) - University of Chile
Yeah Object>>#finalize is supposed to do what you said but unfortunately it does not work... Maybe it's a VM bug or maybe it's not supported any more. We'll see if Eliot answer the thread. 2015-01-13 15:55 GMT+01:00 Johan Fabry <jfabry@dcc.uchile.cl>:
No, just putting the cleanup code in a finalize method does not seem to be working, sadly.
On Jan 13, 2015, at 11:18, Sven Van Caekenberghe <sven@stfx.eu> wrote:
Object>>#finalize ?
On 13 Jan 2015, at 15:13, Johan Fabry <jfabry@dcc.uchile.cl> wrote:
Hi all,
does anybody here have experience with hooking into the GC mechanism so that an object gets notified when it is collected? I have a setup here with auto generated classes that I would like to remove when their unique instance disappears. So Iâd like to let the GC figure out all the complicated tracking and inform me whenever such an object is collected, then Iâll zap the class as well.
Experience reports, hints and tips are most welcome!
---> Save our in-boxes! http://emailcharter.org <---
Johan Fabry - http://pleiad.cl/~jfabry PLEIAD lab - Computer Science Department (DCC) - University of Chile
---> Save our in-boxes! http://emailcharter.org <---
Johan Fabry - http://pleiad.cl/~jfabry PLEIAD lab - Computer Science Department (DCC) - University of Chile
you also need to register the object for cleanup, in the WeakRegistry. (not on my machine, sorry I cannot put an example, but look around) Esteban
On 13 Jan 2015, at 11:55, Johan Fabry <jfabry@dcc.uchile.cl> wrote:
No, just putting the cleanup code in a finalize method does not seem to be working, sadly.
On Jan 13, 2015, at 11:18, Sven Van Caekenberghe <sven@stfx.eu> wrote:
Object>>#finalize ?
On 13 Jan 2015, at 15:13, Johan Fabry <jfabry@dcc.uchile.cl> wrote:
Hi all,
does anybody here have experience with hooking into the GC mechanism so that an object gets notified when it is collected? I have a setup here with auto generated classes that I would like to remove when their unique instance disappears. So Iâd like to let the GC figure out all the complicated tracking and inform me whenever such an object is collected, then Iâll zap the class as well.
Experience reports, hints and tips are most welcome!
---> Save our in-boxes! http://emailcharter.org <---
Johan Fabry - http://pleiad.cl/~jfabry PLEIAD lab - Computer Science Department (DCC) - University of Chile
---> Save our in-boxes! http://emailcharter.org <---
Johan Fabry - http://pleiad.cl/~jfabry PLEIAD lab - Computer Science Department (DCC) - University of Chile
participants (4)
-
Clément Bera -
Esteban Lorenzano -
Johan Fabry -
Sven Van Caekenberghe