On May 28, 2009, at 9:51 AM, Mike Crowe wrote:

I'm running into a CPU usage problem with my Cocoa application. Basically once the app has been running for a few hours it starts, all of a sudden, to
steadily consume an increasing amount of CPU.

On further investigation with Instruments, it seems that object allocations
seem to be the cause:

# Object Address Category Creation Time Size Responsible
Library    Responsible Caller
26319 0x9b23e50 02:34.281 Foundation - [NSNotificationCenter
addObserver:selector:name:object:]
26320 0x9b23e60 02:34.285 Foundation - [NSNotificationCenter
addObserver:selector:name:object:]
26321 0x9b23e70 02:34.290 Foundation - [NSNotificationCenter
addObserver:selector:name:object:]
26322 0x9b23e80 02:34.295 Foundation - [NSNotificationCenter
addObserver:selector:name:object:]
26323 0x9b23e90 02:34.299 Foundation - [NSNotificationCenter
addObserver:selector:name:object:]
26324 0x9b23ea0 02:34.302 Foundation - [NSNotificationCenter
addObserver:selector:name:object:]
26325 0x9b23eb0 02:34.306 Foundation - [NSNotificationCenter
addObserver:selector:name:object:]
26326 0x9b23ec0 02:34.309 Foundation - [NSNotificationCenter
addObserver:selector:name:object:]

The screenshot below from Instruments shows the graph steadily increasing as
more and more observers are added:
http://jottle.net/Instruments.png

You can show the extended detail view and see the full stack trace for those allocations, which should give you a better idea of why it is happening.

Regards,
Ken

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to