Based on the screenshot, I think the problem is with NSURL caching, not NSData objects. Can you try the following:
In your application deletion, set the source URL cache:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
Add the following to your application delegate:
- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application { [[NSURLCache sharedURLCache] removeAllCachedResponses]; }
A cache file will be created: "Library/Caches/your_app_id/nsurlcache"
A link to an Apple example is here: Cache URL
The code is not verified, but this (or something similar) should sort your problem + plus you can experiment with cache sizes.
Can you post another screenshot of Allocations in action with this code? I would expect the memory usage to stop growing and smooth out.
source share