[Cuis-dev] Cuis web package

Andres Valloud ten at smallinteger.com
Thu Jun 13 12:01:53 PDT 2024


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.


More information about the Cuis-dev mailing list