On Fri, Jun 1, 2012 at 9:14 AM, Tony Huang <[email protected]> wrote: > Thank you guys. > > @Bert >> I don't think it makes a difference. You should note that you have to >> explicitly manage the lifetime of a persistent handle, e.g. you'd have >> to Dispose() it when you no longer need it. Using persistent handles >> where locals would be appropriate sounds like a recipe for blowing >> your foot off to me. > > If I declared a Persistent handle like this: > > Persistent<Object> someObject = GetObject(); > > And in the desturctor of the Persistent handle, it will not automatically > invoke the Dispose() method? >
No, it will not. Any object which has a Persistent<> wrapping it, will stay alive until Dispose() is invoked. You might also be interested in weak references which might be a better alternative to religiously keeping track of deletions. See the Persistent::MakeWeak() method and associated callback. Nikhil
