• 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: NSEnumerator retaining objects?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSEnumerator retaining objects?


  • Subject: Re: NSEnumerator retaining objects?
  • From: Shawn Erickson <email@hidden>
  • Date: Tue, 8 Mar 2005 09:26:09 -0800


On Mar 8, 2005, at 9:20 AM, James Bucanek wrote:

I'm trying to track down some memory leaks and I'm running into something weird. At least I think it is....

I'm running ObjectAlloc and watching the retain/release/autorelease cycles of a few objects. I expected to see two or three events per object, but I'm seeing thousands. When I step through the ObjectAlloc events, it refers to code that looks like this:

1:      NSEnumerator* e = [array objectEnumerator];
2:      Node* node;
3:      while ( (node=(Node*)[e nextObject])!=nil )
4:          {
5:          // do something with node
6:          }

Every node object is seeing a retain followed by an autorelease on line 3. Does NSEnumerator retain every object it iterates through, then autorelease it on the next pass through the loop?

Possibly.

I have several concerns with this,

What concerns? I assume performance..?

-Shawn

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSEnumerator retaining objects?
      • From: James Bucanek <email@hidden>
References: 
 >NSEnumerator retaining objects? (From: James Bucanek <email@hidden>)

  • Prev by Date: NSEnumerator retaining objects?
  • Next by Date: Re: Finder visibility flag
  • Previous by thread: NSEnumerator retaining objects?
  • Next by thread: Re: NSEnumerator retaining objects?
  • Index(es):
    • Date
    • Thread