14

I've cleared my app of leaks using the leaks tool, but I still notice that the objectalloc tool jumps up in the number of objects allocated and footprint when I switch views.

I'm especially seeing high numbers of:

GeneralBlock-16 with mostly Foundation responsible with caller NSLogv

and

GeneralBlock-0 with mostly QuartzCore responsible

Any tips on what I can do to further debug this?

Thanks!

mac_55
  • 4,130
  • 7
  • 31
  • 40

2 Answers2

24

The ObjectAlloc tool is designed to graph total object allocation over time, and it doesn't take deallocations into account. Essentially: it will always go up.

What you can do is look at the Net Bytes and # Net columns. These columns will adjust based on the number of objects you deallocate, and if you're concerned about total object allocation you can use these to gauge your program's performance.

You can take a look at this thread on the Apple Support forums - it deals more with what Instruments measures and how you can test your app.

Tim
  • 59,527
  • 19
  • 156
  • 165
  • Sorry, perhaps my question was unclear. I'm aware that object allocation always goes up, however I was referring to Net Bytes and #Net which also never go down, which is worrying. Pushing views in a navigation controllers increases these numbers greatly, whilst popping views doesn't decrease them. Also the sheer number of GeneralBlock-0 is disturbing. I really want to know why so many 0-bit objects are in existance. – mac_55 Jun 30 '09 at 11:26
  • 5
    This isn't quite correct; you can configure the Allocations instrument to only track live allocations. In that case, the columns will reflect exactly what is in memory right now. – bbum Feb 20 '11 at 19:23
  • bbum is right, in Xcode 4, the default Allocations template in Instrument shows 'All Allocations' broken down into columns, displaying both Live Bytes and Overall Bytes. – MattyG Sep 11 '11 at 09:27
6

You should check out http://developer.apple.com/videos/wwdc/2010/?id=311.

Great video from WWDC 2010 about memory analysis with Instruments.

Alex
  • 1,689
  • 18
  • 27