0

I've got a question, my app consists of several CollectionViews next to each other in a ScrollView, if one Cell gets clicked, a Detail view appears, using this code:

DetailCell *detailCell = [[DetailCell alloc] initWithDetails:_pageCategorie and: indexPath];
[_nav pushViewController:detailCell animated:YES];

Everything works flawlessly, you can go to the DetailView, then back to CollectionView and then on the DetailView of another Cell, and so on... The Problem is, that if you repeat this several times (10+) the app starts to heavily lag on my iPhone. So I think when I leave a DetailView and get back to the CollectionView, the DetailView remains in the memory. What can I do against this behavior? I'm using ARC if it does matter

seniorbenelli
  • 838
  • 1
  • 9
  • 20
  • How do you know your DetailView remains in memory? – Merlevede Mar 02 '14 at 23:47
  • Xcode's memory tool says, that the usage is increasing every time I open a DetailView and leaving it doesn't decrease the usage, so I think it remains in memory – seniorbenelli Mar 03 '14 at 08:47
  • Does anybody have an idea? – seniorbenelli Mar 04 '14 at 19:30
  • Implement `dealloc` in DetailCell, please, and use NSLog to see whether it gets called when you "go back to CollectionView". If it does, it does not "remain in memory". – matt Mar 04 '14 at 19:42
  • Also why do you say DetailCell in your code but DetailView in your words? This suggests you've got a bug somewhere - you may be creating/pushing the wrong thing. – matt Mar 04 '14 at 19:43

1 Answers1

0

Xcode's memory tool can be tricky. Depending on how it is configured it might be reporting allocated objects, instead of objects in use. This means that even if your objects get deallocated, the memory tool might report otherwise.

Check this link to see how you can modify the configuration of memory report in XCode.

Community
  • 1
  • 1
Merlevede
  • 8,140
  • 1
  • 24
  • 39