Re: OOP leaking with registered object
Roland Plüss <[email protected]>
| Newsgroups | gmane.comp.lang.smalltalk.gnu.general |
|---|---|
| Message-ID | <[email protected]> |
On 04/05/2015 01:38 PM, Holger Hans Peter Freyther wrote:
> On Sun, Apr 05, 2015 at 12:16:36AM +0200, Roland Plüss wrote:
>
>> What you mean with shuting down all processes? As far as I know GST
>> knows only one process: the main process. When I'm outside the main
>> process should it not be the case that each call to gst_perform or
>> similar is conclusive, hence finishing up? So how would a finalization
>> listener work once you exit again the byte code? Similar how would
>> saving a snapshot work? There you have to also save the image and
>> somehow "exit" back into C++ land to shut down. Am I missing here something?
> I am referring to Smalltalk processes that continue to run. With
> spawning the "gst" application you have:
>
> st> Process allInstancesDo: [:each | each printNl]
> Process(nil at highIOPriority, terminated)
> Process('finalization listener' at timingPriority, waiting on a semaphore)
> Process('idle' at idlePriority, ready to run)
> Process('delay process' at timingPriority, waiting on a semaphore)
>
> So these processes run, they refer to objects. Now I don't know
> how many objects you want to be collected but you need to give up
> references and you need to make sure the finalization listener is
> woken up and runs
>
>
> 'finalization listener' process:
>
>
> initialize [
> ...
>
> finalizerProcess :=
> [[gcSemaphore wait. self startFinalizers] repeat]
> forkAt: Processor timingPriority.
> ...
> ]
>
>
> startFinalizers [
> "Private - Fire a low-priority process to finalize the objects"
> <category: 'idle tasks'>
> | local localFinalizerProcess |
> local := gcArray.
> gcArray := nil.
>
> localFinalizerProcess := [:array | array do: [:each | each mourn]]
> newProcessWith: {local}.
> localFinalizerProcess priority: Processor userSchedulingPriority.
> localFinalizerProcess name: 'finalization worker'.
> localFinalizerProcess resume
> ]
>
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++?
--
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 iEYEARECAAYFAlUhV68ACgkQjKGu9ysRWfoGDQCeMxfWMqpTKMm2sbTnIDcsF/Uy PqEAnjD7Xu7siMX2wqsSXy82V+8KU03d =MMGT -----END PGP SIGNATURE-----