0

I have created some UITableViews in storyboard and written custom classes for each of them. I have dragged and dropped the tableview objects into my main view controller to access them. In the UITableView custom classes, I allocate some class level objects in "numberOfSectionsInTableView" delegate method. I want to release all the class level objects allocated in the numberOfSectionsInTableView method in the dealloc method. But the dealloc is not getting called even if I move to some other view controller. Does anyone have any idea why this is not called, or where else I can release these objects. (ARC is turned off)

saikamesh
  • 4,569
  • 11
  • 53
  • 93

2 Answers2

1

Try to find something about UIViewController life cycle. Try to release your objects in viewDidUnload method and put breakpoints there. This pic should be useful for you: enter image description here

Valentin Shamardin
  • 3,569
  • 4
  • 34
  • 51
1

Here are some things you could do:

  1. turn ARC on?
  2. Are you sure its not accessed? make an NSLog(@"ACCESSED"); in your dealloc method
  3. use viewDidUnload method to release things
  4. directly release them in their methods if they are not needed anymore
Janosch Hübner
  • 1,584
  • 25
  • 44
  • You can turn on ARC and changing the build flags, you can disable ARC for some specific headers if you like.. click on your project -->targets -->build phases --> "Compile Sources" and then double click on a .m file and type in "-fno-objc-arc" this will diable ARC for the specific file ,) – Janosch Hübner Oct 05 '12 at 13:17