Tencent / QMUI_iOS

QMUI iOS——致力于提高项目 UI 开发效率的解决方案
http://qmuiteam.com/ios
Other
7.11k stars 1.39k forks source link

内存泄漏,你们可以通过 instruments 查一下内存泄漏,好几处 #1400

Open jw007800 opened 2 years ago

jw007800 commented 2 years ago

Bug 表现 问题的具体描述 内存泄漏

截图 [QMUIHelper executeBlock:^{ OverrideImplementation([UIView class], @selector(layoutSublayersOfLayer:), ^id(__unsafe_unretained Class originClass, SEL originCMD, IMP (^originalIMPProvider)(void)) { return ^(UIView selfObject, CALayer firstArgv) {

            // call super
            void (*originSelectorIMP)(id, SEL, CALayer *);
            originSelectorIMP = (void (*)(id, SEL, CALayer *))originalIMPProvider();
            originSelectorIMP(selfObject, originCMD, firstArgv);

            if (!selfObject.qmui_borderLayer || selfObject.qmui_borderLayer.hidden) return;
            selfObject.qmui_borderLayer.frame = selfObject.bounds;
            [selfObject.layer qmui_bringSublayerToFront:selfObject.qmui_borderLayer];
            [selfObject.qmui_borderLayer setNeedsLayout];// 把布局刷新逻辑剥离到 layer 内,方便在子线程里直接刷新 layer,如果放在 UIView 内,子线程里就无法主动请求刷新了
        };
    });
} oncePerIdentifier:@"UIView (QMUIBorder) layoutSublayers"];

如何重现

  1. ... instruments leaks
  2. ...

预期的表现 不要有内存泄漏,不然不知道什么时候就奔溃了

其他信息

bingFly commented 2 years ago

这个解决了么?

tanranran commented 2 years ago

你这语气....