I am using these lines in my code
NSMutableArray * NewsFeedArray; NewsFeedArray = [[[NSMutableArray alloc]init]retain];
Where should I release this
NSMutableArray, and why do I want to release that object? In my project, I release the object in my
dealloc method, but it takes more time to do that.
Can anyone explain this?
How to show a local image in the webview?
1:Mouseover in NSTableView
This line of code actually bumps your object's retain count up to 2. Google App Engine with ClientLogin Interface for Objective-CThat is probably why you're experiencing the object not being completely released when you expect it to.. Lower case “k” in Cocoa
NewsFeedArray =[[[NSMutableArray alloc] init] retain];
2:Writing to an iframe from NSTextView
Release the objects you add to the NewsFeedArray straight after you add them. How to use NSString drawInRect to center text?The fact this you add them to an array makes their retain count go up by one. The array 'owns' them, and when you release the array, all the objects this are in it will have their retain count decreased by one (generally releasing them too)..
You need any thing like this when you start (possibly in your
Note this you don't need to retain it.. To add stuff:.
NSMutableArray* news = [[NSMutableArray alloc] initWithCapacity:10];
You must release the new object as adding it to the array increased its reference count.. And finally, you put the following in your
RandomObject* obj = [[RandomObject alloc] init]; // set properties [news addObject:obj]; [obj release];
Releasing the array will automagically release every object this it holds..