[MacRuby-devel] Phantom closed windows in document based apps

Milos & Slavica milos.and.slavica at me.com
Tue Jan 31 15:39:29 PST 2012


Thanks Joshua for your reply!

While, GC.start did not make a difference even when it was placed right inside the block before inspecting window controllers, your second suggestion did. For the benefit of anyone else encountering this problem (and following Joshua’s advice), I started with the Obj-C template, replaced the .h and .m files with their ruby equivalents and required garbage collection and 64-bit architecture in the build settings. After that, the app continued to manage memory correctly. 

This is potentially a big deal, because MacRuby developers may not notice this issue easily, so if you are not sure, I suspect it is worth checking. 

Many thanks Joshua for your help!

Milos 


On 31 Jan 2012, at 05:24, Joshua Ballanco wrote:

> You're likely seeing the effect of GC. I suspect that if you did a "GC.start" before inspecting, or compiled the Obj-C template and ran it under GC, then you would find more consistent results. :)
> 
> - Josh
> On Friday, January 20, 2012 at 2:09 PM, Milos & Slavica wrote:
> 
>> Hi,
>> 
>> Has anyone seen this problem:
>> 
>> - Start a new Xcode project with the MacRuby document-based application template. 
>> 
>> - Open a number of windows.
>> 
>> - Close a window (leaving others open).
>> 
>> - Then do:  NSApp.windows.map {|win| p win.windowController.document}
>> 
>> - This produces something like:
>> #<Document:0x401341960>
>> #<Document:0x401354820>
>> nil
>> #<Document:0x40135b4e0>
>> 
>> Notice the “nil”. It appears that, without any additional code, template apps fail to release window controllers, which keeps their windows and views in memory even after the close operation. (Objective-c template, on the other hand, successfully releases window controllers on close.) It is interesting in the above console result that the controller did close (or at least decouple) the associated document. 
>> 
>> Is this somehow peculiar to my setup, or is it a deeper problem? What can I do about it?
>> 
>> Many thanks in advance!
>> 
>> Milos
>> 
>> 
>> On 22 Dec 2011, at 12:02, Andy Stechishin wrote:
>> 
>>> I cannot say or certain why the problem occurred. I did further
>>> investigation on another computer and the problem did not repeat with
>>> the same same code. I then rebooted the first computer and the problem
>>> went did not occur.
>>> 
>>> I apologize for not posted that the problem was corrected to the list.
>>> In all honesty, when I never received any responses, I was not sure
>>> the email ever made it on the list.
>>> 
>>> As I am still running Snow Leopard on all of my systems, I continue to
>>> run XCode 4.0.2. I have had no further problems as described below.
>>> The advice to upgrade is well-meant but not possible with the current
>>> version of the OS that is running. I am planning to begin the upgrade
>>> process in the break between Christmas and New Years.
>>> 
>>> Andy Stechishin
>>> 
>>> On Thu, Dec 22, 2011 at 1:59 AM, Maik Kempe <root at breaking-limits.com> wrote:
>>>> Hi all,
>>>> 
>>>> I know, it is a lame advice but maybe you should upgrade Xcode / MacRuby. Then you can create a Document based application via the wizard which works like charm for me.
>>>> 
>>>> If everything is not working, drop me a line and i can send you the generated skeleton from the wizard.
>>>> 
>>>> On Dec 22, 2011, at 8:46 AM, Min Soo Kim wrote:
>>>> 
>>>>> Hi Andy Stechishin,
>>>>> 
>>>>> I am have the same problem as you.
>>>>> It seems that no one is answering to your question.
>>>>> Have you find a what the problems was?
>>>>> 
>>>>> Thank you in advance
>>>>> 
>>>>> Min Soo Kim
>>>>> 
>>>>> 
>>>>> On Jul 23, 2011, at 12:46 PM, Andy Stechishin wrote:
>>>>> 
>>>>>> I am trying to make a Document based MacRuby application. I create the
>>>>>> new project in Xcode4 (4.0.2) and immediately select build and run.
>>>>>> The application starts but there is no "Untitled" window and the
>>>>>> File->New and File->Open menu options are greyed out. Following the
>>>>>> same sequence of actions except choosing an Objective-C based
>>>>>> application, the "Untitled" Window appears and the menu options are
>>>>>> active. I have compared the project contents, the xib files (including
>>>>>> File Owners and First Responders) and linked frameworks and can find
>>>>>> no difference that would explain the different operation. It would
>>>>>> seem that there is some problem with NSDocumentController in the
>>>>>> MacRuby version. It is either not there or has been added properly to
>>>>>> the responder chain.
>>>>>> 
>>>>>> Am I missing something? Or is this a defect? Has anyone else
>>>>>> encountered this and found a work around?
>>>>>> 
>>>>>> Andy Stechishin
>>>>>> _______________________________________________
>>>>>> MacRuby-devel mailing list
>>>>>> MacRuby-devel at lists.macosforge.org
>>>>>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>>>> 
>>>>> _______________________________________________
>>>>> MacRuby-devel mailing list
>>>>> MacRuby-devel at lists.macosforge.org
>>>>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>>> 
>>>> Maik Kempe
>>>> Br∑αkíηg £ímíτs | impossible = POSSIBLE
>>>> 
>>>> --
>>>> 
>>>> Br∑αkíηg £ímíτs
>>>>  root at breaking-limits.com
>>>>  breaking-limits.com
>>>> 
>>>> _______________________________________________
>>>> MacRuby-devel mailing list
>>>> MacRuby-devel at lists.macosforge.org
>>>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>> _______________________________________________
>>> MacRuby-devel mailing list
>>> MacRuby-devel at lists.macosforge.org
>>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>> 
>> _______________________________________________
>> MacRuby-devel mailing list
>> MacRuby-devel at lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> 
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20120201/4ae8f074/attachment.html>


More information about the MacRuby-devel mailing list