• 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: NSImages are killing my WindowServer
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSImages are killing my WindowServer


  • Subject: Re: NSImages are killing my WindowServer
  • From: John Stiles <email@hidden>
  • Date: Thu, 23 Mar 2006 10:40:08 -0800

On Mar 23, 2006, at 10:35 AM, James Bucanek wrote:

John Stiles wrote on Thursday, March 23, 2006:
See if your idea of releasing them sooner helps.
You could also use ObjectAlloc to see just how many NSImages you're
making... it may be more than you expected!

I think you're right about the number. Looking at the code again, I think it could approach a thousand or more at a time.


Ricky Sharp wrote on Thursday, March 23, 2006:
Something I always code up when working with many images is an "ImageFactory".
While the contents of NSImages are cached, I find it helpful to provide a
helping hand. My factory often implements it's own cache of a fixed size
where I implement a 'most-recently-used' policy. This allows me to easily
play around with the cache size to experiment with memory consumption vs.
speed.

Thanks to both John and Ricky for the suggestions.

Looking at the structure of my code, I think it might be easier to create a cache. All of the code that calls this function expects an autoreleased NSImage, and I'd have to return a retained one if I want the clients to release it immediately.

The client code couldn't just wrap it with a new NSAutoreleasePool?

My concern is in reusing NSImage. What do I have to do to "reset" an NSImage so I can draw another IconRef into it? Right now, the NSImage that gets drawn and converted into a TIFF has all of the yummy transparency information and all of that other chocolately Cocoa goodness. I'm afraid if I start drawing multiple icons over each other that I'm going to have problems.

Maybe something along these lines: [[NSColor clearColor] set]; NSRectFill( ... your image's frame ... ); _______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: NSImages are killing my WindowServer
      • From: James Bucanek <email@hidden>
References: 
 >Re: NSImages are killing my WindowServer (From: James Bucanek <email@hidden>)

  • Prev by Date: Re: NSImages are killing my WindowServer
  • Next by Date: Does anyone know what iCal events are?
  • Previous by thread: Re: NSImages are killing my WindowServer
  • Next by thread: Re: NSImages are killing my WindowServer
  • Index(es):
    • Date
    • Thread