• 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
Garbage collection and reachable objects
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Garbage collection and reachable objects


  • Subject: Garbage collection and reachable objects
  • From: "McLaughlin, Michael P." <email@hidden>
  • Date: Thu, 2 Jul 2009 09:56:32 -0400
  • Acceptlanguage: en-US
  • Thread-topic: Garbage collection and reachable objects

Although I read the relevant documentation, I am still a bit unsure of what
is "reachable" by Xcode standards when garbage collection is *required*.

In particular, suppose (in a .mm source file)

1) I use a iterator, iter, to traverse an STL (non-Cocoa?) list, L.
2) I have a local struct, repeatedly overwritten, with one of its members
equal to such an iterator.
3) For some items in L, I save iter in the local struct and, later,
push_back (thus copy) this struct onto a more global STL list (or vector or
set or map).
4) I finish using iter to traverse L and iter goes out of (local) scope.

Are all saved instances of iter still reachable and thereby immune to
garbage collection?

Or, should I put a pointer in my struct and save the dereferenced iterator
as &(*it)?  The latter seems kludgy and contrary to the intent but I've seen
errors that suggest that it might be necessary.

TIA for any help.

--
Mike McLaughlin

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

This email sent to email@hidden

  • Follow-Ups:
    • Re: Garbage collection and reachable objects
      • From: Howard Moon <email@hidden>
  • Prev by Date: Re: Feature requests for iPhone dev?
  • Next by Date: Re: Garbage collection and reachable objects
  • Previous by thread: Re: Feature requests for iPhone dev?
  • Next by thread: Re: Garbage collection and reachable objects
  • Index(es):
    • Date
    • Thread