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)
Asked
Active
Viewed 1,295 times
0
-
Possible duplicated http://stackoverflow.com/questions/9219030/dealloc-not-being-called-on-arc-app – alexandresoli Oct 05 '12 at 12:17
-
What are "class level objects"? And in what `-dealloc` are you trying to release them? – Caleb Oct 05 '12 at 13:07
-
I meant to say class level variables. In the UITableView custom class's dealloc im tryiing to release them. – saikamesh Oct 05 '12 at 16:29
2 Answers
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:

Valentin Shamardin
- 3,569
- 4
- 34
- 51
1
Here are some things you could do:
- turn ARC on?
- Are you sure its not accessed? make an
NSLog(@"ACCESSED");
in your dealloc method - use viewDidUnload method to release things
- 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