Hi all, 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 I am not using NSNotificationCenter directly anywhere in my application. I've also noticed that when the app is hidden with [mainWindow orderOut:nil]; and shown again, that the CPU usage returns to normal. I've looked through the NSNotificationCenter docs, but haven't found anything obvious. I'm a novice Cocoa developer so apologies if I have overlooked something simple. Any help is much appreciated, Mike. _______________________________________________ Cocoa-dev mailing list ([email protected]) 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 [email protected]
