[Cuis-dev] Cuis web package
Jaromir Matas
mail at jaromir.net
Thu Jun 13 15:13:41 PDT 2024
Hi Andres,
Thanks! I correct myself, yes the circualr referenced objects in this
case should be gc'd indeed.
However,
When you run you example and get to `w first`, the process hasn't run
yet and is still waiting at the Processor's priority 40 list (see
Processor waitingProcessesAt: 40) - so this is the reference at this
point.
When the example finishes execution the UI lets your new process run and
create the semaphore - becoming a zombie because the only (strong)
references are circular now.
So, if I add a `yield` before the gc, the example works as expected:
w := WeakArray new: 1.
w at: 1 put: [Semaphore new wait] newProcess resume.
Processor yield.
Smalltalk garbageCollect.
w first
Does this explain the behavior you observed? Or am I still missing
something?
best,
Jaromir
On 13-Jun-24 9:01:53 PM, "Andres Valloud via Cuis-dev"
<cuis-dev at lists.cuis.st> wrote:
>Check this out. In a workspace, put in the following code.
>
>w := WeakArray new: 1.
>w at: 1 put: [Semaphore new wait] newProcess resume.
>Smalltalk garbageCollect.
>w first
>
>If you evaluate it, you see that the weak array still references the zombie process.
>
>Now, somewhere else in the workspace, do a print-it of 2 + 3. Then, run the last two lines of the first snippet.
>
>Smalltalk garbageCollect.
>w first
>
>And now the process is gone. It appears that workspace do-its are remembering way more than they should.
>
>The fascinating thing is that the reference finder doesn't find the presumptive references (and class skipping is not the issue). So, what's going on here?
>
>On 6/13/24 11:38 AM, Andres Valloud via Cuis-dev wrote:
>>>>So, where is the reference to this zombie process object?
>>>
>>>The process's myList references the new semaphore and the semaphore references the process back. So it won't go away unless the semaphore is signaled or the process terminated from another process (or from Process Browser, Inspector etc.) What do I miss?
>>
>>Why isn't this just a cycle of garbage objects? Who is referencing the semaphore?
>>
>>In others Smalltalk systems, I know for a fact that when I tried this the zombie process and the semaphore were summarily scavenged away with extreme prejudice :p.
>>
>>Andres.
>-- Cuis-dev mailing list
>Cuis-dev at lists.cuis.st
>https://lists.cuis.st/mailman/listinfo/cuis-dev
More information about the Cuis-dev
mailing list