views:

624

answers:

3

I have a situation where I build a view with a table and another view for table header (containing images and labels and buttons). Now I connected the table, image, labels, buttons to variables in my Controller class. Should I release the memory in -dealloc method for all those variables that I connected using Interface Builder? I believe memory is automatically allocated for these variables?

+3  A: 

The answer is best provided by Apple's Memory Management of Nib Objects document. If your code "owns" the NIB (i.e. you called +[NSBundle loadNibNamed: foo owner: bar]) then your code needs to destroy the NIB resources.

Graham Lee
Updated link: http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmNibObjects.html
Jason Moore
Key sentence: "Objects in the nib file are created with a retain count of 1 and then autoreleased."
Jason Moore
A: 

I knew it, i knew it, i knew it, but i still posted the question. I'm so frustrated right now. Actually i'm getting *EXC_BAD_ACCESS* error, and when i try to run the application with Instruments it doesn't show me any error. :( The error doesn't appear when i remove the release statements of objects in nib (specifically the table object).

I'll trace it some more and then post the issue if i'm still stuck. Thanks for you help.

Mustafa
A: 

Posted the issue here: *EXC_BAD_ACCESS* with no stack trace

Mustafa