• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: objectAtIndex
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: objectAtIndex


  • Subject: Re: objectAtIndex
  • From: Bryan Henry <email@hidden>
  • Date: Sun, 01 Nov 2009 14:48:12 -0500

That line alone does not indicate any memory leaks occurring due to over-retaining objects. You'll need to provide more context (the surrounding code, etc).

The object returned by -[NSArray objectAtIndex:] is the actual object (ie. pointer to the actual object's space in memory) stored in the array, not a copy. When you add objects to an array, as well, the object stored in the array is not a copy but the object itself.

- Bryan

On Nov 1, 2009, at 2:44:07 PM, Nava Carmon wrote:

Hi,

When I ran Build and Analyze on my code, it has pointed as a possible leak the following statement:

NSObject *anObject = [anArray objectAtIndex:i];

anObject wasn't released and here's the question: whether anObject is a copy of actual object, that is a member of anArray or it's the object itself?

Should I release it?

Thanks,
Nava
_______________________________________________

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


References: 
 >objectAtIndex (From: Nava Carmon <email@hidden>)

  • Prev by Date: objectAtIndex
  • Next by Date: Re: objectAtIndex
  • Previous by thread: objectAtIndex
  • Next by thread: Re: objectAtIndex
  • Index(es):
    • Date
    • Thread