nverinaud / NVSlideMenuController

A slide menu done right for iOS.
MIT License
175 stars 33 forks source link

Application Size using NVSlideMenuController #23

Closed balram3429 closed 11 years ago

balram3429 commented 11 years ago

I am writing this to you in reference to my earlier question being responded by your team here : https://github.com/nverinaud/NVSlideMenuController/issues/21#issuecomment-25626978

if ([self.slideMenuController.contentViewController isKindOfClass:[HomeViewController class]]) { [self.slideMenuController closeMenuAnimated:YES completion:nil]; } else { HomeViewController homeVC = /* get the new instance or reuse one */; [self.slideMenuController closeMenuBehindContentViewController:homeVC animated:YES ...]; }

I am satisfied with your earlier answer but my doubts are here. 1) Suppose I load an Item HomeViewController first. (control follows if route as above & loads HomeViewController) 2) Next I load a new Item AboutViewController. (control follows if route as above & loads a AboutViewController) 3) Again If I load an Item HomeViewController, What happens to the instance that was loaded in Step 1 ? (control always follows else route because the self.slideMenuController.contentViewController is an instance of AboutViewController )

Don't you think that instance created at step1 is somewhere there on the stack but not on top. Isn't that causing a memory lump.? So if my HomeViewController loaded in step1 loads some data of 10Mb, then the new instance being created at step3 will certainly be making the size of app tp 20MB (since the step1 instance & step2 instance are there on the stack now.) I hope, I have made you clear about my question. Kindly clarify.

nverinaud commented 11 years ago

The library does not maintain any stack. You do not need to worry about memory consumption. :)

balram3429 commented 11 years ago

I am Using ARC & I am worried because every time I load a new controller that loads data from Google Map, increases the run time size of app. So I was concerned. I forgot to mention about NVSlideMenuController as entitlement on my about page of App. But I am doing that now in my Current version of App.

nverinaud commented 11 years ago

Okay, I reproduced that. I'm working on it.

nverinaud commented 11 years ago

According to my tests, no leaks in NVSlideMenuController with and without ARC enabled. Your code may leak somewhere (strong ref cycle ?).

balram3429 commented 11 years ago

I saw a significant rise in memory usage during the run time, So I reported. Please see this, as how I am using your control. This is how I am loading a Navigation controller with NVSideMenuController.

UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:[self prepareSideMenuFrame]];
nav.navigationBarHidden = YES;
nav.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self.navigationController presentViewController:nav animated:YES completion:^{
    [self hideIndicator];
}];

This method returns an instance of NVSlideMenuController:

- (NVSlideMenuController *)prepareSideMenuFrame {
    self.sideMenuController = [[btSideMenuViewController alloc]init];
    btHomeViewController *selectionController = [[btHomeViewController alloc]init];
    self.frameViewCtrllr = [[NVSlideMenuController alloc]initWithMenuViewController:self.sideMenuController andContentViewController:selectionController];
    return self.frameViewCtrllr;
}
nverinaud commented 11 years ago

Sorry, this is the wrong place to ask for your memory issues. Please post on StackOverflow instead.

balram3429 commented 11 years ago

Thanks. I am looking for strong references.