Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App crash #6

Open
patriksharma opened this issue Sep 1, 2010 · 6 comments
Open

App crash #6

patriksharma opened this issue Sep 1, 2010 · 6 comments

Comments

@patriksharma
Copy link

As i integrated Photo viewer in my app. it is working fine in simulator But when we check it on Iphone device(3G) the app gets crash while uploading the pictures . As i found (In Instruments) the object allocation increases while uploading the pictures in the Photo Viewer . Object allocation go beyond the 23.5 MB. As i checked while debugging the application , when we click on the picture the object allocation increases from (currently) 5 MB to 15 MB(after clicking on the picture). So i think just because of object allocation app gets crash .

@Garfinkle
Copy link

I'm having the same issue on the iPad. I'm loading 23 photos at 1024x768 and when scrolling through a level 1 memory warning I thrown. When I check in instruments each image is allocating approx 2-3 mb and at about 24mb the memory warning is thrown. The analyser doesn't show any potential leaks. It appear that the images are being released but not quick enough so too many get stored in memory.

Any one know how to improve this so images are unloaded an released the moment you move away? In therory only 3 images need to be retained, the one you ate looking at and one eitherside.

Any help would be great for this issue

@patriksharma
Copy link
Author

  • (void)moveToPhotoAtIndex:(NSInteger)index animated:(BOOL)animated{

    pageIndex = index;

    leftButton.enabled = !(index-1 < 0);
    rightButton.enabled = !(index+1 >= [self.photoSource count]);

    [self queueReusablePhotoViewAtIndex:index];

    //[self loadScrollViewWithPage:index-1];
    [self loadScrollViewWithPage:index];
    //[self loadScrollViewWithPage:index+1];

    EGOCache *cache = [[EGOCache alloc] init];
    [cache clearCache];
    [cache release];

    [self.scrollView scrollRectToVisible:((EGOPhotoImageView*)[self.photoViews objectAtIndex:index]).frame animated:animated];
    [self setNavTitle];

    if([[[[_photoSource._comments objectAtIndex:index] objectForKey:@"numComments"] stringValue] isEqualToString:@"0"])
    {
    [Message.customView setHidden:YES];
    }
    else {
    [Message.customView setHidden:NO];
    }

    m_pNumComments.text = [[[_photoSource._comments objectAtIndex:index] objectForKey:@"numComments"] stringValue];

    // reset any zoomed side views
    if (index + 1 < [self.photoSource count] && (NSNull_)[self.photoViews objectAtIndex:index+1] != [NSNull null]) {
    [((EGOPhotoImageView_)[self.photoViews objectAtIndex:index+1]) killScrollViewZoom];
    }
    if (index - 1 >= 0 && (NSNull_)[self.photoViews objectAtIndex:index-1] != [NSNull null]) {
    [((EGOPhotoImageView_)[self.photoViews objectAtIndex:index-1]) killScrollViewZoom];
    }

    [self setCaptionTitle];
    }

@patriksharma
Copy link
Author

Hii the above posted function is of photoviewcontroller.m class.

Somehow iam able to fix it . i called Egocache.m class everytime to clear the last uploaded image in the photoviewer . So that there are less chance of crash

You try this function may be this helpful to you and let me know :-)

@Garfinkle
Copy link

Hi Patriksharma.

The magic line in the code you posted is
EGOCache *cache = [[EGOCache alloc] init]; [cache clearCache]; [cache release];

Thank you very much :D

@Garfinkle
Copy link

The issue seems to have re appeared, not sure what is causing it

@patriksharma
Copy link
Author

it is working fine with Iphone 4G but it is crashing in Iphone 3GS and IOA 3.1.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants