سؤال

I use OLImage in the viewB's drawRect method to load a local gif image. I use a normal ViewA to push ViewB, and pop ViewB repeatedly. After about 20 times, my app crashed after received several memory warnings. I use instrument to monitor the memory usage, and you can see the result below. Instrument statics

My code to load gif is like:

@property (weak, nonatomic) IBOutlet OLImageView *gifImageView;


    if (!self.gifImageView.image) {
        self.gifImageView.image = [OLImage imageNamed:@"好.gif"];
        [self.gifImageView setUserInteractionEnabled:YES];
        [self.gifImageView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap:)]];
    }

I'm use ARC, I think the gif data should be released by iOS when ViewB popped. Or at least when my app received memory warnings. Am I doing something wrong? OR this can be more general question that how to release VM memory in ARC?

هل كانت مفيدة؟

المحلول

It turns out it's maybe an issue of OLImage itself. I made a pull request for this issue. Check out the commit here if you are interested.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top