• 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: NSNotificationCenter CPU usage problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSNotificationCenter CPU usage problem


  • Subject: Re: NSNotificationCenter CPU usage problem
  • From: Ken Thomases <email@hidden>
  • Date: Thu, 28 May 2009 22:20:22 -0500

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 (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


References: 
 >NSNotificationCenter CPU usage problem (From: Mike Crowe <email@hidden>)

  • Prev by Date: Re: Send Keyboard Events
  • Next by Date: Re: Performance, Efficiency - Coding practice
  • Previous by thread: NSNotificationCenter CPU usage problem
  • Next by thread: issue porting resource files code from 10.4 to 10.5
  • Index(es):
    • Date
    • Thread