views:

547

answers:

1

I use CoreData to store image data that user took from iPhone's Camera. Over time, the memory consumed by these objects keep increasing, but I don't know how to clear those objects from the memory.

How should this be done?

+2  A: 

You can tell the managedObjectContext to retain or not retain objects (in addition to the ones you retain) with:

[managedObjectContext setRetainsRegisteredObjects:YES];

See http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/index.html?http%3A//developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdRelationships.html for a discussion of what this does.

Note that you also have to be careful not to retain and leak the objects yourself, or this will have no effect.

-Wil

Wil Shipley