Re: OOP leaking with registered object

Roland Plüss <[email protected]>
Newsgroups gmane.comp.lang.smalltalk.gnu.general
Message-ID <[email protected]>

On 04/06/2015 06:41 PM, Holger Hans Peter Freyther wrote:
> 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
I'm using a similar trick in my own scripting language. Hoped I can get
away in Smalltalk without it. It's certainly a working solution albeit
not the most good one. Should do the trick for the time being.

-- 
Mit freundlichen Grüssen
Plüss Roland

Leader und Head Programmer
- Game: Epsylon ( http://www.indiedb.com/games/epsylon )
- Game Engine: Drag[en]gine ( http://www.indiedb.com/engines/dragengine
, http://dragengine.rptd.ch/wiki )
- Normal Map Generator: DENormGen ( http://epsylon.rptd.ch/denormgen.php )
- Sowie verschiedene Blender Export-Skripts und Game-Tools

_______________________________________________
help-smalltalk mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-smalltalk
signature.asc (application/pgp-signature, 181 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iEYEARECAAYFAlUkA00ACgkQjKGu9ysRWfoQPQCgiXacvGn4yQWN0jaHshFdVUMu
uHgAn2/iTI0eEoVpUxmaJ+YHKoGSFHVg
=4MCJ
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.