<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Aug 24, 2012, at 9:07 AM, Gary Byers wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Your example leaks memory; it's not surprising that it behaves<br>like it's leaking memory, is it ?<br></div></blockquote><div><br></div><div><br></div><div>The memory leak is not surprising and could be addressed with a autorelease-pool. However, what we are seeing is very different. The memory leak makes RealMem (as observed via Activity Monitor) climb up, less than 1 MB per call. A leak to be sure, but its linear over time. When the CPU/Mem burst takes place memory is not growing linearly but is essentially EXPLODING to the point where the ALL physical system memory, e.g., 8GB, will be used up, i.e., no free system memory left,  and  CCL and sometimes even OS X itself will lock up. In other words, a single iteration of this loop will have memory go up by multiple gigabytes!</div><div><br></div><div>Here is an example that I am pretty sure will also reproduce this strange behavior on your Mountain Lion machine. One difference, making it a bit more similar to our real code is the use of choose-file-dialog instead of a standard alert.  We ran this on several machines using just the current version of CCL from the Mac App store (untouched). This crashed CCL (1.8.1 I believe) on every Mountain Lion machine we have. Watch CPU and RealMem of CCL closely as you keep mindlessly selecting some silly file somewhere on your disk over and over. </div><div><br></div><div>Is this crashing now? I really hope this is because this is driving us crazy. </div><div><br></div><div>___________</div><div><br></div><div><br></div><div><br></div><div><br></div><div><div>(defmacro IN-MAIN-THREAD (() &body body)</div><div>  (let ((thunk (gensym))</div><div>        (done (gensym))</div><div>        (result (gensym)))</div><div>    `(let ((,done nil)</div><div>           (,result nil))</div><div>       (flet ((,thunk ()</div><div>                (setq ,result (multiple-value-list (progn ,@body))</div><div>                      ,done t)))</div><div>         (gui::execute-in-gui #',thunk)</div><div>         (process-wait "Main thread" #'(lambda () ,done))</div><div>         (values-list ,result)))))</div><div><br></div><div><br></div><div>(defun CRASH-ME ()</div><div>  (in-main-thread ()</div><div>    (dotimes (i 100)</div><div>     ; (ccl::with-autorelease-pool</div><div>        (ccl::choose-file-dialog)</div><div>        (ccl::process-run-function</div><div>         '(:name "pointless")</div><div>         #'(lambda ()</div><div>             ))</div><div>        ;)</div><div>      )))</div><div><br></div><div>; (crash-me)</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div> </div></div><div><br></div><div><br></div><div><br></div><div><br></div><br><blockquote type="cite"><div><br>I couldn't get this to crash under either Snow Leopard or Mountain Lion;<br>my naive, uninformed guess is that the leak may be worse on Snow Leopard<br>(because some of the Mountain Lion code may be using ARC.)  It's also<br>possible I suppose that something in the 10.6 Cocoa libraries establishes<br>an autorelease pool to limit the memory leaking and that the 10.8 Cocoa<br>libraries don't do this.<br><br>(loop<br>  (create-a-bunch-of-autoreleased-nsobjects))<br><br>will eventually run out of memory.  That doesn't seem interesting.<br><br>(loop<br>  (objc:with-autorelease-pool<br>    (create-a-bunch-of-autoreleased-nsobjects)))<br><br>(or equivalent) will generally have bounded memory usage.  (That isn't<br>exactly interesting either, but none of this is news.)<br><br>On Thu, 23 Aug 2012, Alexander Repenning wrote:<br><br><blockquote type="cite">A bit of a pattern is emerging:<br></blockquote><blockquote type="cite">- no obvious connection to version of CCL<br></blockquote><blockquote type="cite">- strong connection to version of OS X (Mountain Lion, 10.8.0 and 10.8.1<br></blockquote><blockquote type="cite">only)<br></blockquote><blockquote type="cite">- quite inconsistent<br></blockquote><blockquote type="cite">- can happen when making threads or not servicing events from main thread<br></blockquote><blockquote type="cite">for some time<br></blockquote><blockquote type="cite">- more likely to crash on CCL 32 than CCL 64<br></blockquote><blockquote type="cite">- has a CPU and RealMemory surge manifestation (observe with Activity<br></blockquote><blockquote type="cite">Monitor)?<br></blockquote><blockquote type="cite">Here is a test case.?<br></blockquote><blockquote type="cite">? -?Load code and eval?(crash-me)<br></blockquote><blockquote type="cite">- observe CCL System memory in?Activity Monitor<br></blockquote><blockquote type="cite">- keep pressing return to OK the modal dialog.<br></blockquote><blockquote type="cite">Things may be fine OR you get some initial hick up with some small<br></blockquote><blockquote type="cite">CPU/RealMem surges making things slower and slower. In some cases RealMem<br></blockquote><blockquote type="cite">will just use up all you have and crash CCL after growing to a couple of<br></blockquote><blockquote type="cite">GB.?<br></blockquote><blockquote type="cite">If you have a Mountain Lion machine please let me know if you also get<br></blockquote><blockquote type="cite">problems with this.?<br></blockquote><blockquote type="cite">puzzled, ?Alex<br></blockquote><blockquote type="cite">____________<br></blockquote><blockquote type="cite">;(in-package :xlui)<br></blockquote><blockquote type="cite">;; inilined from Libraries<br></blockquote><blockquote type="cite">(defun NATIVE-STRING (String) "<br></blockquote><blockquote type="cite">? Return a native string"<br></blockquote><blockquote type="cite">? (#/autorelease (ccl::%make-nsstring String)))<br></blockquote><blockquote type="cite">(defmethod STANDARD-ALERT-DIALOG ((Message string) &key?<br></blockquote><blockquote type="cite">? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (Yes-Text "OK")<br></blockquote><blockquote type="cite">? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (No-Text nil)<br></blockquote><blockquote type="cite">? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (Cancel-Text nil)<br></blockquote><blockquote type="cite">? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (Explanation-Text)<br></blockquote><blockquote type="cite">? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (Is-Critical nil))<br></blockquote><blockquote type="cite">? (let ((Alert (#/init (#/alloc ns:ns-alert))))<br></blockquote><blockquote type="cite">? ? (#/setMessageText: Alert (native-string Message))<br></blockquote><blockquote type="cite">? ? (when Yes-Text (#/addButtonWithTitle: Alert (native-string Yes-Text)))<br></blockquote><blockquote type="cite">? ? (when No-Text (#/addButtonWithTitle: Alert (native-string No-Text)))<br></blockquote><blockquote type="cite">? ? (when Cancel-Text (#/addButtonWithTitle: Alert (native-string<br></blockquote><blockquote type="cite">Cancel-Text)))<br></blockquote><blockquote type="cite">? ? (when Explanation-Text (#/setInformativeText: Alert (native-string<br></blockquote><blockquote type="cite">Explanation-Text)))<br></blockquote><blockquote type="cite">? ? (#/setAlertStyle: Alert (if Is-Critical #$NSCriticalAlertStyle<br></blockquote><blockquote type="cite">#$NSWarningAlertStyle))<br></blockquote><blockquote type="cite">? ? (case ?(#/runModal Alert)<br></blockquote><blockquote type="cite">? ? ? (#.#$NSAlertFirstButtonReturn t)<br></blockquote><blockquote type="cite">? ? ? (#.#$NSAlertSecondButtonReturn nil)<br></blockquote><blockquote type="cite">? ? ? (#.#$NSAlertThirdButtonReturn (throw :cancel nil)))))<br></blockquote><blockquote type="cite">(defmacro IN-MAIN-THREAD (() &body body)<br></blockquote><blockquote type="cite">? (let ((thunk (gensym))<br></blockquote><blockquote type="cite">? ? ? ? (done (gensym))<br></blockquote><blockquote type="cite">? ? ? ? (result (gensym)))<br></blockquote><blockquote type="cite">? ? `(let ((,done nil)<br></blockquote><blockquote type="cite">? ? ? ? ? ?(,result nil))<br></blockquote><blockquote type="cite">? ? ? ?(flet ((,thunk ()<br></blockquote><blockquote type="cite">? ? ? ? ? ? ? ? (setq ,result (multiple-value-list (progn ,@body))<br></blockquote><blockquote type="cite">? ? ? ? ? ? ? ? ? ? ? ,done t)))<br></blockquote><blockquote type="cite">? ? ? ? ?(gui::execute-in-gui #',thunk)<br></blockquote><blockquote type="cite">? ? ? ? ?(process-wait "Main thread" #'(lambda () ,done))<br></blockquote><blockquote type="cite">? ? ? ? ?(values-list ,result)))))<br></blockquote><blockquote type="cite">;; the actual crasher<br></blockquote><blockquote type="cite">(defun CRASH-ME ()<br></blockquote><blockquote type="cite">? (in-main-thread ()<br></blockquote><blockquote type="cite">? ? (dotimes (i 100)<br></blockquote><blockquote type="cite">? ? ? (standard-alert-dialog "HELLO")<br></blockquote><blockquote type="cite">? ? ? (ccl::process-run-function<br></blockquote><blockquote type="cite">? ? ? ?'(:name "pointless")<br></blockquote><blockquote type="cite">? ? ? ?#'(lambda ()<br></blockquote><blockquote type="cite">? ? ? ? ? ?)))))<br></blockquote><blockquote type="cite">; (crash-me)<br></blockquote><blockquote type="cite">?<br></blockquote><blockquote type="cite">On Aug 23, 2012, at 1:17 PM, Paul Krueger wrote:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">      FWIW, I recently upgraded to Mountain Lion and am NOT seeing any<br></blockquote><blockquote type="cite">      Cocoa-related problems with either the IDE or my own Cocoa<br></blockquote><blockquote type="cite">      interfaces and I've been editing lots of lisp files. But I am<br></blockquote><blockquote type="cite">      still on a pretty old version of CCL: 1.7-dev-r14583M-trunk<br></blockquote><blockquote type="cite">      ?(DarwinX8664)<br></blockquote><blockquote type="cite">Paul<br></blockquote><blockquote type="cite">On Aug 23, 2012, at 1:21 PM, Alexander Repenning<br></blockquote><blockquote type="cite"><<a href="mailto:Alexander.Repenning@colorado.edu">Alexander.Repenning@colorado.edu</a>> wrote:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">      We are experiencing some errors, e.g., crashing CCL/Cocoa<br></blockquote><blockquote type="cite">      when just editing a file (with Hemlock). So far we have<br></blockquote><blockquote type="cite">      nothing completely reproducible but I wonder:<br></blockquote><blockquote type="cite">- how others experienced new kinds of issues with CCL in OS X<br></blockquote><blockquote type="cite">Mountain Lion (10.8.0)?<br></blockquote><blockquote type="cite">- is there a certain set of fixes introduced into CCL<br></blockquote><blockquote type="cite">specifically addressing?OS X Mountain Lion. In other words is<br></blockquote><blockquote type="cite">there some, presumably recent, ?version of CCL that should be<br></blockquote><blockquote type="cite">used to avoid trouble?<br></blockquote><blockquote type="cite">Alex<br></blockquote><blockquote type="cite">Prof. Alexander Repenning<br></blockquote><blockquote type="cite">University of Colorado<br></blockquote><blockquote type="cite">Computer Science Department<br></blockquote><blockquote type="cite">Boulder, CO 80309-430<br></blockquote><blockquote type="cite">vCard: <a href="http://www.cs.colorado.edu/~ralex/AlexanderRepenning.vcf">http://www.cs.colorado.edu/~ralex/AlexanderRepenning.vcf</a><br></blockquote><blockquote type="cite">_______________________________________________<br></blockquote><blockquote type="cite">Openmcl-devel mailing list<br></blockquote><blockquote type="cite"><a href="mailto:Openmcl-devel@clozure.com">Openmcl-devel@clozure.com</a><br></blockquote><blockquote type="cite"><a href="http://clozure.com/mailman/listinfo/openmcl-devel">http://clozure.com/mailman/listinfo/openmcl-devel</a><br></blockquote><blockquote type="cite">_______________________________________________<br></blockquote><blockquote type="cite">Openmcl-devel mailing list<br></blockquote><blockquote type="cite"><a href="mailto:Openmcl-devel@clozure.com">Openmcl-devel@clozure.com</a><br></blockquote><blockquote type="cite"><a href="http://clozure.com/mailman/listinfo/openmcl-devel">http://clozure.com/mailman/listinfo/openmcl-devel</a><br></blockquote><blockquote type="cite">Prof. Alexander Repenning<br></blockquote><blockquote type="cite">University of Colorado<br></blockquote><blockquote type="cite">Computer Science Department<br></blockquote><blockquote type="cite">Boulder, CO 80309-430<br></blockquote><blockquote type="cite">vCard: <a href="http://www.cs.colorado.edu/~ralex/AlexanderRepenning.vcf">http://www.cs.colorado.edu/~ralex/AlexanderRepenning.vcf</a><br></blockquote><blockquote type="cite"><br></blockquote></div></blockquote></div><br><div>
<span class="Apple-style-span" style="font-size: 12px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" style="font: 12.0px Helvetica">Prof. Alexander Repenning</font></p><p style="margin: 0.0px 0.0px 0.0px 0.0px"><br class="khtml-block-placeholder"></p><p style="margin: 0.0px 0.0px 0.0px 0.0px">University of Colorado</p><p style="margin: 0.0px 0.0px 0.0px 0.0px">Computer Science Department</p><p style="margin: 0.0px 0.0px 0.0px 0.0px">Boulder, CO 80309-430</p><p style="margin: 0.0px 0.0px 0.0px 0.0px"><br class="khtml-block-placeholder"></p><p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" style="font: 12.0px Helvetica">vCard: <a href="http://www.cs.colorado.edu/~ralex/AlexanderRepenning.vcf">http://www.cs.colorado.edu/~ralex/AlexanderRepenning.vcf</a></font></p><br class="Apple-interchange-newline"></span></span></span>
</div>
<br></body></html>