Reputation: 5232
I am creating a app with MapView and UIImagePicker. I am displaying map on screen and its showing route as user moves on. User can capture images in between. I have two screens for that..
When I go to screen 1 to screen 2. I show an ImagePicker and allow user to capture Images. When I pop back to screen 1 I release
all objects and make it nil
. This task generally done in viewDidUnload
but I was getting memory issues so I did it when my view controller pops. So my all objects get release and nil as soon as I get done with them.
When I go to my login screen from map I am doing every thing I know like:
nil
value to all those object.When I run the app by profiling and there is no run time leak avaiable But even in Activity Monitor my app's real memory continuesly get increase :(
After 10-12 images get captured I am getting Received memory warning. Level=1
I am not even storing UIImage object in memory. I am writing this in document dir and storing string path only.
Please help me and guide me what else can be done to solve this issue.
UPDATE
While releasing objects on back button I am using:
- (void)releaseObjects {
[mapViewNewTour setDelegate:nil];
[mapViewNewTour removeFromSuperView];
[mapViewNewTour release];
mapViewNewTour = nil;
[lblNavTitle release];
lblNavTitle = nil;
[btnEdit release];
btnEdit = nil;
[txtTourName release];
txtTourName = nil;
[vwTourName release];
vwTourName = nil;
[mutDictOfflineSharing release];
mutDictOfflineSharing = nil;
[mutArrImage release];
mutArrImage = nil;
[_routeLine release];
_routeLine = nil;
[_routeLineView release];
_routeLineView = nil;
[aLazyLoader release];
}
Upvotes: 0
Views: 483
Reputation: 3481
I recommend you run instruments and see where memory is used. There are specific instruments for memory usage analysis. The instrument you will want is Activity monitor and VM tracker.
Also I recommend you double check that you are not running with NSZombieEnabled (check it in schemes), as it will cause memory warnings.
Upvotes: 0
Reputation: 25632
ARC is supported on 4.3 as well, so use it.
Your approach with a dedicated "releaseEverything" method is broken all the way - it shows lack of ownership tracking and is a hack at best.
viewDidUnload
is now deprecated anyway and not called by the system in iOS 6 (which you should build against).
Don't fight the frameworks - do it the "right" way.
Upvotes: 3