<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
p.MsoNoSpacing, li.MsoNoSpacing, div.MsoNoSpacing
        {mso-style-priority:1;
        margin:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body lang="EN-US" link="blue" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">Hi Juan, Gerald,</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I've just tried Gerald's sequence on a clean image too and it runs as expected, indeed:</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Simple fork</p>
<p class="MsoNormal">0</p>
<p class="MsoNormal">0</p>
<p class="MsoNormal">Handled exception</p>
<p class="MsoNormal">0</p>
<p class="MsoNormal">Debugger creation</p>
<p class="MsoNormal">0</p>
<p class="MsoNormal">100</p>
<p class="MsoNormal">100</p>
<p class="MsoNormal">Debugger close</p>
<p class="MsoNormal">106</p>
<p class="MsoNormal">106</p>
<p class="MsoNormal">Garbage collect   "Note: I ran an extra GC at the end to clear all processes"</p>
<p class="MsoNormal">0</p>
<p class="MsoNormal">0</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">But then I just played erratically with opening and closing debuggers and three UI's got "stuck" after a short while: now I can't get rid of them, all terminated but referenced from somewhere, thus won't be GC'd.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">a Process terminated 40 (3081490) Formerly: Morphic UI</p>
<p class="MsoNormal">a Process terminated 40 (20413) Formerly: Morphic UI</p>
<p class="MsoNormal">a Process terminated 39 (3343717) Formerly: Morphic UI</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Then I ran Gerald's sequence again and it worked as expected again, clearing (GC) all terminated processes - except the old "stuck" ones, indeed...
</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">My question is how to "unreference" a terminated process to make it garbage collectable?
</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I guess I can find all terminated processes like this:</p>
<p class="MsoNormal">( Process allSubInstances select: [ :process | process isTerminated ] ) explore</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">and explore all places it's referenced from like this:</p>
<p class="MsoNormal">( Object allSubInstances select: [:obj | obj pointsTo: (self at: 1)] ) explore</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">but that doesn't help me understand WHY they're still being referenced from all those places after termination and how to remove those references...</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I not even sure my question makes good sense, really... Any help understanding it would be greatly appreciated :)</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Best,</p>
<p class="MsoNormal">Jaromir</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNoSpacing"><span style="color:#2E75B6"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#8FAADC"><o:p> </o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="mso-element:para-border-div;border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="border:none;padding:0in"><b>From: </b><a href="mailto:juan@cuis.st">Juan Vuletich</a><br>
<b>Sent: </b>Friday, October 21, 2022 0:21<br>
<b>To: </b><a href="mailto:cuis-dev@lists.cuis.st">Discussion of Cuis Smalltalk</a><br>
<b>Cc: </b><a href="mailto:cuis.01@klix.ch">Gerald Klix</a>; <a href="mailto:mail@jaromir.net">
Jaromir Matas</a><br>
<b>Subject: </b>Re: [Cuis-dev] [DEFECT] Debugger leaves terminated processes</p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt">On 10/20/2022 1:20 PM, Gerald Klix via Cuis-dev wrote:<br>
> Hi all, Hi Juan,<br>
><br>
> I think I found the cause of my huge images:<br>
> The Debugger (or process termination)<br>
> leaves terminated processes hanging around.<br>
><br>
> First I saved the image before running the<br>
> killer-Block (see the attached killit.st):<br>
><br>
> -- snip --<br>
> beforeLargeStack.image<br>
> -rw-rw-r-- 1 bear bear 27M Okt 20 17:50 <br>
> Haver6.0-5496-beforeLargeStack.image<br>
> -- snap --<br>
><br>
> Than I ran killit and simply closed the debugger window<br>
> and saved the image:<br>
><br>
> -- snip --<br>
> -rw-rw-r-- 1 bear bear 1.9G Okt 20 17:51 <br>
> Haver6.0-5496-afterLargeStack.image<br>
> -- snap --<br>
><br>
> From 27 megabytes to 1.9 gigabytes in 20 seconds,<br>
> that's quite a feature, albeit a bad one.<br>
><br>
> When I print all existing processes -- see diagnoseKillit.st -- I<br>
> could see there are a lot of terminated processes hanging around.<br>
><br>
> I did `self break` and closed the debugger: More terminated processes.<br>
> Bad enough: `Smalltalk garbageCollect` does not help.<br>
><br>
> The first part of RunningProcesses.txt is the transcript<br>
> output after running the killer-block.<br>
> (There are already some terminated processes, because I used<br>
> image to implement the fixes, I just posted).<br>
> The second part is transcript output after one `self break`;<br>
> I didn't check exactly, but there are more terminated processes.<br>
><br>
><br>
> Best Regards,<br>
><br>
> Gerald<br>
<br>
I just tried on a fresh Cuis.<br>
1) Evaluated your killer 10M<br>
2) waited for it to finish<br>
3) closed the debugger.<br>
4) 2 terminated processes.<br>
5) Smalltalk garbageCollect<br>
6) no terminated processes.<br>
<br>
Looks ok to me.<br>
<br>
-- <br>
Juan Vuletich<br>
cuis.st<br>
github.com/jvuletich<br>
researchgate.net/profile/Juan-Vuletich<br>
independent.academia.edu/JuanVuletich<br>
patents.justia.com/inventor/juan-manuel-vuletich<br>
linkedin.com/in/juan-vuletich-75611b3<br>
twitter.com/JuanVuletich<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>