help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] OOP leaking with registered object


From: Holger Hans Peter Freyther
Subject: Re: [Help-smalltalk] OOP leaking with registered object
Date: Mon, 6 Apr 2015 18:41:54 +0200
User-agent: Mutt/1.5.23 (2014-03-12)

On Sun, Apr 05, 2015 at 05:41:31PM +0200, Roland Plüss wrote:

> So I need to run this 'finalization listener' process somehow and this
> cleans up? How would I trigger this from C++? And as a follow up
> question would it not be better to just call a full garbage collection
> run? After all there is only supposed to be one application object
> holding all the script sources one way or the other. I drop the
> reference of this one at exit time so a garbage collector run should
> clean all up properly. How can I run such a fill garbage collection from
> C++?

I don't think you can easily trigger this from C/C++. The full
shutdown requirement is nothing we had sofar. I am just telling
you what we have and hope you can fill-in the blanks.

In C there is "_gst_global_gc" at the end it will run the
mournn_objects() function. This will schedule calling "gcSemaphore
signal" on the semaphore used by the "finalization listener". This
means the "finalization listener" Smalltalk process will be runnable
again and will be executed at some point in time. The finalization
listener will run worker code to mourn more objects. Now the listener
does not know when the "localFinalizeProcess" is done or how many
of them still run.


Easy: Trigger a global garbage collect

st> ObjectMemory globalGarbageCollect

Harder: Wait for finalization listener to be done.

E.g. you can put a "count" in ProcSched.st (you need to
patch libgst/dict.c with the new member too) to see how
often it executed... or executed last.


Harder: You need to keep track how many finalization
workers were spawned and if they have exited.



The other question. If you know which kind of objects
hold references you want to finalize and you have decided
you want to give them up. Why don't you trigger this cleanup
from your code?

 MyBindingBaseClass allSubinstancesDo: [:each | each dispose ].


holger



reply via email to

[Prev in Thread] Current Thread [Next in Thread]