• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSData being retained?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSData being retained?


  • Subject: Re: NSData being retained?
  • From: Shawn Erickson <email@hidden>
  • Date: Thu, 22 Jul 2004 14:01:07 -0700

On Jul 22, 2004, at 1:20 PM, Jim Ways wrote:

Ive narrowed it down to a single line of code

//Runs 100% fine
NSData *imageData = [url resourceDataUsingCache:YES];

//increases memory size (leak)
NSData *imageData = [url resourceDataUsingCache:NO];

Am i keeping a list of cache infomation somewhere? Am
i storing aliases to my data somehow?

The difference seen here may be a red herring as they say.

When you tell it to use the cache it should ... since it is using a cache ... return you the same data object returned by a prior call to resourceDataUsingCache when targeting the same URL instance. So if you have a leak issue you wouldn't see things grow since you keep getting back the same instance

In the case you tell it not to use the cache then it will return a different NSData instance on each call. In other words it is allocating a new instance.

Anyway if you want folks on this list to be able to help more you will likely need to post the exact code involved not a cut down version. Also what version of the Mac OS X are you using?

Consider using ObjectAlloc (make sure to enable CF & ObjC ref counting when you fire it up), the latest Shark version, and/or OmniObjectMeter [1] to analyze what is taking place.

-Shawn

[1] <http://www.omnigroup.com/developer/omniobjectmeter/>
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >Re: NSData being retained? (From: Jim Ways <email@hidden>)

  • Prev by Date: Re: Java and MacOS
  • Next by Date: When did NSURLConnection start working with NSURLHandles?
  • Previous by thread: Re: NSData being retained?
  • Next by thread: Re: NSData being retained?
  • Index(es):
    • Date
    • Thread