DMLazyScrollView
DMLazyScrollView copied to clipboard
memory usage increases till crash
the viewControllerArray will retain the controllers inside increasing the memory usage and finally crashing the app after some time. best way to test it is having controllers with some images... every time i swipe the memory increases to never go back down....
how do i fix this?
Thanks for the help and keep up the good job
I've not enough time to work on it but if you can upload a sample project I'll try to fix the error.
The problem is: LazyView reloads every page, every time when you go to next or previous page. if you try to go to next page and return to previous page for a bit the result will be app crashes. I try to use it with NSXML Parser (text and images) with ARC.
I solved the memory problem like this... set NSNULL to viewControllerArray where not index, index - 1 and index + 1 I am a beginner so my Code is a childish one but it solves the problem.
- (UIViewController *) controllerAtIndex:(NSInteger) index {
NSLog(@"viewcontrollerARRAY Before : %@",viewControllerArray);
if (delegateCallCount == 0) {
for (int j = 0; j < numberOfPages; j++) {
if (j == index || j == index - 1 || j == index + 1) {
}else {
[viewControllerArray replaceObjectAtIndex:j withObject:[NSNull null]];
}
}
delegateCallCount++; // in viewDidLoad set "delegateCallCount = 0;".
}else if(delegateCallCount == 2){
delegateCallCount = 0;
}else{
delegateCallCount++;
}
.
.
.
return res;
}