On Sep 21, 2009, at 05:40, Sebastian Morsch wrote:
in my SQLite backed Core Data app, a search action fetches from a large number of objects (>1.000.000) only to show them in a table. When the user exits search mode (search string empty), I'd like to free the managed objects to restore the app's normal memory footprint. I do that by resetting the managed context, but it doesn't seem to work, physical memory stays where it was when the fetch was completed. Strangely, in ObjectAlloc instrument I can see the fetched objects being deallocated, but the physical memory still peaks.
Core Data has (or, I should say, had, since I haven't investigated the behavior in Snow Leopard) its own internal in-memory cache of object and attribute data, which means that, up to a point, data from a persistent store is in memory twice. AFAICT there's no way of unloading or controlling this cache, which has a maximum size that Core Data chooses.
So you can get back the memory occupied by the objects themselves (and their attribute value objects), but your memory footprint could stick at a couple of hundred MB. You could just ignore the issue (the footprint won't grow beyond certain point, so it's sort of harmless), or try some of the fetch performance optimization techniques described in the Core Data documentation to see if you can keep unwanted information out of the cache from the beginning.
_______________________________________________ Cocoa-dev mailing list ([email protected]) 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 [email protected]
