QMUI_iOS icon indicating copy to clipboard operation
QMUI_iOS copied to clipboard

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

Open jw007800 opened this issue 2 years ago • 2 comments

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. ...

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

其他信息

  • 设备: [例如模拟器、iPhone、iPad]
  • iOS 版本: [iOS 14.x]
  • Xcode 版本: [Xcode 12.x]
  • QMUI 版本: 最新版本

jw007800 avatar May 11 '22 08:05 jw007800

这个解决了么?

bingFly avatar Aug 25 '22 07:08 bingFly

你这语气....

tanranran avatar Sep 14 '22 03:09 tanranran