GPUimage内存释放

1、 上下文释放

GPUImageMovieWriter.m
    inputRotation = kGPUImageNoRotation;
    _movieWriterContext = [GPUImageContext sharedImageProcessingContext];
//    _movieWriterContext = [[GPUImageContext alloc] init];
//    [_movieWriterContext useSharegroup:[[[GPUImageContext sharedImageProcessingContext] context] sharegroup]];

GPUImageContext.m  ##很重要,会一直增加内存,导致app被kill
- (void)dealloc {
    if (_coreVideoTextureCache != NULL) {
        CFRelease(_coreVideoTextureCache);
    }
}

2、必须要加的代码,内部的buffer回收方法

[[GPUImageContext sharedImageProcessingContext].framebufferCache purgeAllUnassignedFramebuffers];

3、循环引用

    __weak typeof(self) weakSelf = self;
    __weak typeof(uielement)weakUielement = uielement;
    [progressFilter setFrameProcessingCompletionBlock:^(GPUImageOutput *output, CMTime time) {
        dispatch_async(dispatch_get_main_queue(), ^{
            __strong typeof(weakSelf)self = weakSelf;
            int index = (int)time.value /time.timescale;
            NSLog(@"index:%d",index);
            self.sImageView.image = [UIImage imageNamed:@"000"];
            self.sImageView.transform = CGAffineTransformMakeRotation(M_PI*index);
            [weakUielement updateWithTimestamp:time];
        });
    }];
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Swift1> Swift和OC的区别1.1> Swift没有地址/指针的概念1.2> 泛型1.3> 类型严谨 对...
    cosWriter阅读 13,793评论 1 32
  • 这是16年5月份编辑的一份比较杂乱适合自己观看的学习记录文档,今天18年5月份再次想写文章,发现简书还为我保存起的...
    Jenaral阅读 7,876评论 2 9
  • ORA-00001: 违反唯一约束条件 (.) 错误说明:当在唯一索引所对应的列上键入重复值时,会触发此异常。 O...
    我想起个好名字阅读 10,786评论 0 9
  • [TOC] 内存管理 一、托管堆基础 在面向对象中,每个类型代表一种可使用的资源,要使用该资源,必须为代表资源的类...
    _秦同学_阅读 9,291评论 0 3
  • 今天得到大学举办了2019春季开学典礼,我没怎么看直播,下午得到在首页推送了开学典礼的内容,并把13篇演讲全文整理...
    威威一笑阅读 2,750评论 3 3