Re: NSString componentsSeparatedByString returned memory
Re: NSString componentsSeparatedByString returned memory
- Subject: Re: NSString componentsSeparatedByString returned memory
- From: John Stiles <email@hidden>
- Date: Fri, 14 Dec 2007 13:53:36 -0800
Don't release the NSArray yourself.
How are you determining that the NSArray object is being leaked? It's
more likely that it's retained by another source that you don't know
about—and you don't need to know about. Just trust the Cocoa memory
management rules to do their job.
Martin Linklater wrote:
Hi - I'm drilling down on memory leaks in my code and I'm finding some
strange memory usage that I don't quite understand. I'm calling
'componentsSeparatedByString' on an NSString and I seem to be finding
a memory leak with the NSArray that is returned.
If I release the NSAutoreleasePool after the call the memory for the
NSArray is not free'd up. If I manually release the NSArray I get a
double free error later on in the code when the NSAutoreleasePool is
released.
This doesn't make sense - you either release objects yourself or you
let the NSAutoreleasePool do it right ? With this case I seem to
either get a leak or an error - neither method seems to properly clean
the memory up.
Am I missing something subtle here ? Thanks.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden