• 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
Non-retained NSImages still available?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Non-retained NSImages still available?


  • Subject: Non-retained NSImages still available?
  • From: "Matt R" <email@hidden>
  • Date: Fri, 4 Apr 2008 18:29:36 -0700

I'm sorry for asking a memory management question but I was hoping someone
could help me understand this situation.

I have a series of NSImages I place in an array (subclass instance variable)
when a custom NSView is init'd:

initWithFrame:
....
     imgArray[x] = [NSImage imageNamed:@"foo.jpg"];

Throughout the scope of my app, when the drawRect fires, these images always
appear properly. But today I suddenly released that I never retained them,
which has me kind of baffled. My understanding was that once the method that
creates the auto-released object exits, eventually that object will be
released. Other objects, like NSStrings, which are created within this
view's methods, seem to need to be retained as the view's methods use the
object, but the NSImage array shows up without being retained. Can someone
please help me understand why this is?

Thank you for your help,
-Matt
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Non-retained NSImages still available?
      • From: "stephen joseph butler" <email@hidden>
  • Prev by Date: Re: NSMutableArray removeObject: crash
  • Next by Date: Re: Non-retained NSImages still available?
  • Previous by thread: Re: How do I embed a font in an app?
  • Next by thread: Re: Non-retained NSImages still available?
  • Index(es):
    • Date
    • Thread