On 29/04/2009, at 10:05 PM, Тимофей Даньшин wrote:

        NSArray *ret = [mutableRet copy];
//      NSLog(@"The number of items to be returned is: %i", [ret count]);
        [mutableRet release];
        return ret;


I don't see why your NSLog line should cause a problem, but your memory management at the end of the function is wrong, so may have a bearing on it.

Why copy mutableRet when you just release it anyway? Instead, just return it with an autorelease:

return [mutableRet autorelease];

There is no need to copy a mutable array just so you can return it as a non-mutable array - it is an array and its mutability is invisible to the client of this code. As it stands you're leaking the copy because it is never released.

--Graham


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to