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: Sun, 5 Apr 2015 13:38:04 +0200
User-agent: Mutt/1.5.23 (2014-03-12)

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
    ]




reply via email to

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