Re: Re: Changing dock icon on the fly a lot = molasses?
Re: Re: Changing dock icon on the fly a lot = molasses?
- Subject: Re: Re: Changing dock icon on the fly a lot = molasses?
- From: "Shawn Erickson" <email@hidden>
- Date: Thu, 7 Sep 2006 09:13:04 -0700
On 9/7/06, Shawn Erickson <email@hidden> wrote:
On Sep 7, 2006, at 8:36 AM, Craig Hunter wrote:
> It works fine, but I notice that my app starts to feel slower and less
> responsive with a lot of these calls over a long period of time
> (days).
>
> I am using the dock icon as a progress/status display that changes
> about
> every 5 seconds, so over days of running the app there can be tens of
> thousands of calls to change the dock icon. Is this slowdown
> expected (ie,
> am I doing something totally unreasonable), or could I be handling
> this
> better? I have tried profiling with Shark to see if I could tell
> what was
> slowing down, but haven't really been able to pin it down. The
> only thing I
> know for sure is that not calling this subroutine every 5 seconds
> eliminates
> the problem. I am also badging the dock icon with a few simple
> drawing
> operations after the icon change, but have eliminated that as a cause.
This sounds like a memory leak to me. I would launch your application
with ObjectAlloc (select track objc allocations, etc.) and let it run
long enough to get to a steady state of memory usage then set a
marker. Then view memory allocations relative to that marker. Look
for allocation instances that build up after that point (the second
column is the one to watch for this if IIRC).
If you do find instances building up you can pause the application in
ObjectAlloc and look at the allocations events for a representative
instance to understand who created it and/or retained it.
Note xcode provides an launch with option for this in its build menu.
Ok now that I am in front of a system with Xcode... the menu option is
on the Debug under the "Launch Using Performance Tool" submenu. The
ObjectAlloc option I recommend is "Also record CF & ObjC reference
counting" that appears in a sheet when you launch the application you
want to watch in ObjectAlloc and yeah it is the "count" column that
shows you the count of allocation instances that currently exist. If
that keeps increasing as your application runs you may have a memory
leak. The graph column shows total numbers of instances that have
existed at some point as well as current count... the later in solid
color.
Anyway Apple covers this in the following...
<http://developer.apple.com/documentation/Performance/Conceptual/ManagingMemory/Articles/FindingPatterns.html>
-Shawn
_______________________________________________
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