<br><br><div class="gmail_quote">On Feb 13, 2008 10:53 AM, Uwe Loew &lt;<a href="mailto:uwe_loew@gmx.net">uwe_loew@gmx.net</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">






<div bgcolor="#ffffff">
<div><font face="Arial" size="2">Hello squeak professionals,</font></div>
<div><font face="Arial" size="2"></font>&nbsp;</div>
<div><font face="Arial" size="2">in our process monitoring software we use a 
background process to update the displayed values.</font></div>
<div><font face="Arial" size="2"></font>&nbsp;</div>
<div>&nbsp;</div>
<div><font face="Arial" size="2">breakFlag := false.<br>delay := Delay 
forMilliseconds: 10.<br>Processor fork: 
[<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [ 
breakFlag ] whileFalse: 
[<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
backgroundProcess := true.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;Process is now active 
&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
delay 
wait.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.........................................&quot;calling 
the GUI update methods displaying the measured values from the 
process&quot;</font></div>
<div><font face="Arial" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
delay wait.</font></div>
<div><font face="Arial" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
].<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
backgroundProcess := false.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
&quot;Process is going to terminate &quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ] 
at: Processor userPriority - 5</font></div>
<div><font face="Arial" size="2"></font>&nbsp;</div>
<div><font face="Arial" size="2">Processor is an instance of 
ProcessScheduler.</font></div>
<div><font face="Arial" size="2"></font>&nbsp;</div>
<div><font face="Arial" size="2"></font>&nbsp;</div>
<div><font face="Arial" size="2">Something in our GUI update software wastes memory 
and over some days crashes the system. So the user has to stop the background 
display process when leaving the system and to restart it when coming 
back.&nbsp;We now want to automate this switching on and off of the GUI updates 
by checking the screensaver status of windows. Our wish is to check in each 
update cycle, whether the windows-screensaver is on, and depending on this 
status, to update the GUI display or not.</font></div>
<div><font face="Arial" size="2">Can&nbsp;anybody of you give us a hint, how to 
check, whether windows has switched of the desktop-display and displaying the 
screensaver, or is still displaying the desktop&nbsp;containing&nbsp;the squeak 
window?</font></div>
<div><font face="Arial" size="2"></font> <br></div></div></blockquote></div><br><br>Which OS? Windows, Mac, Linux, other?<br><br>One option is to find and fix your memory leak. I haven&#39;t tried this before in Squeak (my applications crash much earlier than that :-P ), but I&#39;d probably start by doing something like:<br>
<br>Smalltalk collect: [ :each | (each isMemberOf: Class) ifTrue: [<br>&nbsp;&nbsp;&nbsp; each name, &#39;: &#39;, each allInstances size, &#39; instances&#39;<br>].<br><br>(there might be a #numInstances method on Behavior; I don&#39;t have an image handy right now)<br>
<br>Inspecting the result after running your program for some time might give some clues as to what is using up your memory.<br><br>You could write a custom screensaver in C, or maybe even in Squeak if you&#39;re keen, and then that screensaver could somehow send a signal to your application - maybe using TCP/IP, or maybe sending a signal to Squeak (can Squeak capture POSIX signals?), or some other mechanism.<br>
<br>Gulik.<br><br>-- <br><a href="http://people.squeakfoundation.org/person/mikevdg">http://people.squeakfoundation.org/person/mikevdg</a><br><a href="http://gulik.pbwiki.com/">http://gulik.pbwiki.com/</a>