1

I am having issue with memory management. I am using arc. I tried setting arrays, oulet to nil in viewdidunload and try the same in dealloc methods.

When I use instruments it does not show any thing, I tried finding resident memory using this link Programmatically retrieve memory usage on iPhone

I have two uitableviewcontrollers added as subview on view when I click on left table other table refreshes.

Each time I tap on a table and refresh the right one, the resident memory is increasing by 2MB.

I am removing all the objects but still it keeps increasing.

Does any one have an idea how to proceed. I know nothing can be told with out code. I am looking for guideline of what could be the possible culprit.

Thanks

Community
  • 1
  • 1
pa12
  • 1,493
  • 4
  • 19
  • 40

1 Answers1

1

Use heap shot analysis.

  • 1) Go to screen
  • 2) Mark heap
  • 3) Tap and refresh table
  • 4) Mark heap
  • 5) Review Heap shot results

You may want to perform this sample or sequence a few times to understand the growth better.

Here's a great write up by bbum: http://www.friday.com/bbum/2010/10/17/when-is-a-leak-not-a-leak-using-heapshot-analysis-to-find-undesirable-memory-growth/

You might also consider reviewing your Cycles and Roots, also using the Leaks Instrument.

justin
  • 104,054
  • 14
  • 179
  • 226
  • I tried the approach you suggested it was much better than what I had previously. I have one question, When I take heap shots it points me to many places like setting font for label, in nsurlconnection and soon showing percentage beside that. I really did not understand why it does that. Any idea. – pa12 Sep 10 '12 at 14:23
  • @dln well, there are a lot of variations in the implementations. some of this you cannot correct (unless you just don't use those features). that's not to say those are bugs in Apple's frameworks, either. it could be growth you have control over, but in some cases, the system may simply be *caching* what it computes or loads from disk, expecting reuse in the near future -- or there may be some lingering references that go away later (those heap shots may decrease as you continue). so just perform the checks regularly, pay attention to the growth you cannot correct, and remember next time. – justin Sep 10 '12 at 14:35
  • but yeah - some of it is really internal, quite complex, and not at all publicly documented. – justin Sep 10 '12 at 14:35
  • 1
    Thanks for the information. I will run through the scenario multiple times to see if that constantly happens – pa12 Sep 10 '12 at 15:41