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: Roland Plüss
Subject: Re: [Help-smalltalk] OOP leaking with registered object
Date: Tue, 07 Apr 2015 18:18:13 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0


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

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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