small medium large xlarge

04 Apr 2009, 15:08
Fredrick Gabelmann (1 post)

Good morning,

I am extremely new to Cocoa Programming, so I do not yet have a full appreciation for memory management or the Garbage Collector available with Objective-C 2.0.

That said, I have been working my way through this book with Garbage Collection enabled, as I personally want to lower the barrier a bit (and I may never do iPhone development). All of the exercises up to the SimpleBrowserNotification exercise have worked flawlessly with GC enabled. However, the progress bar will not work unless I disable GC.

Can anyone let me know what I would need to do to make it work with GC enabled? Or can someone point me to the documentation that could help me?

On a brief aside, I feel that it might be helpful to make a note somewhere in the text that some of the code is not GC compatible. Another possibility would be to put a footnote on some pages that would give the GC compatible version of the code.

Warmest regards,


08 Jun 2009, 19:04
Jaromir Siska (4 posts)

Hello Frederic,

I run into similar difficulties which you describes. The problem is that this example is not GC compatible. The problem is with the object LoadIndicatorController created in MainMenu NIB. This top level object can not be reached from any root object and is collected. You can find some explanation in in Nib file paragraph.

The example can easily be modified to GC compatible by adding a reference to this LoadIndicatorController. Eg. adding an IBOutlet LoadIndicatorController *myLoadIndicatorController into SimpleBrowserController and connecting properly this outlet in the MainMenu NIB resolves the problem.

Best regards Jaromir

You must be logged in to comment