Garbage collection and reachable objects
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