Short version: Have any of you ever used NSCache in a GC-enabled app? If so, then how did you get the garbage collector to collect them?
Long version: I have a framework that is used in a traditional retain-release app and a different GC-enabled app. The framework creates NSCache objects for storage of throw-away objects, and stores these NSCache objects in a CFDictionaryRef. At some point, the CFDictionaryRef is instructed to remove the entire cache when the app no longer needs that cache. That pops the NSCache and deallocates it in the retain-release app, but in the GC app, I ran an Instruments test and found that the NSCache objects and their contents were never being finalized. If I change the code so the code uses NSMutableDictionary instead of NSCache, then the dictionaries and their objects are properly finalized when popped. I want to use NSCache and not NSMutableDictionary, but I can't do this in the GC-enabled app if the collector is going to let the caches live forever. How do I make it so that the collector collects them? I already tried using Instruments to monitor the GC object graph, but the results made no sense. According to Instruments, the NSCache objects were rooted by a non-object memory address created before main() was called, a long time before the objects were made. Also, I noticed that objects in the cache would not identify the cache as their root. (Is that normal?) Nick Zitzmann <http://www.chronosnet.com/> _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com