-
Notifications
You must be signed in to change notification settings - Fork 943
MLeaksFinder有时候会误报? #80
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
Comments
请贴一下详细信息,弹窗的截图等 |
输出下面的信息: |
简单说明一下, 这是个简单的登录页面, 有几个简单的textfield, 有个登录按钮, 点击会进行登录请求, 然后loading有个SVProgresshud, 点击空白去掉hud(touchesBegan方法里实现的), 整个页面大概这些逻辑. |
@willylee007 @Zepo 我也是在iOS11下 UITextField报没释放~ |
@DreamBuddy +1 .页面是销毁的, 估计11下需要对UITextField作额外处理 @Zepo |
试了没能重现,能否提供 demo? |
@Zepo Demo确实没复现,猜测是某些框架引起的,我正在实验 |
测试了一个晚上,很是奇怪 secureTextEntry 为 YES的时候就会内存泄漏,但是demo中即使设置为YES 也不会。。 |
@willylee007 你试试。。看看secureTextEntry这个参数有没有关系 |
我也有这个问题,,不清楚怎么解决,,求教 |
2017-12-05 21:38:35.766938+0800 MiaoMoreNew[3907:417197] Memory Leak: ( |
发现误报,ViewController已经释放了,但是会报MMTextField的内存溢出 |
@Jinzhengxuan 你这个报的是 MMTextField 没释放 |
在iOS11下UITextField好像不会调用Dealloc被释放,是不是iOS11的一个Bug |
上面这个dmeo可以测出泄漏. 虚拟机上没有测出. 难道是真机系统的一个bug? |
@willylee007 11.2 模拟器上也可以重现 |
我这个虚拟机11.1的系统. 真机11.2的系统. |
我也发现这个问题了。。。 |
我也有这个问题,我自己的手机iphone6 11.1,没有报UITextField未释放,但是我同事的手机iphone8p,11.2,会一直报UITextField 未释放 |
昨天升级11.2.1后 就开始报UITextField泄漏了, 升级前是11.1系统,没有这个问题。 |
uitextfiled 确实会误报,看了一篇简书,不知道有没有用http://www.jianshu.com/p/fc90383df61f |
误报: Retain Cycle: ( |
直接在 ViewController 中添加 UITextField,ViewController 释放了,也会误报 UITextField 没有释放,真机和模拟器都是 iOS 11.2 目前可以添加下列类别来暂时屏蔽掉误报问题(不用设置头文件,直接在项目中创建即可): #import <UIKit/UIKit.h>
@interface UITextField (MemoryLeak)
@end #import "UITextField+MemoryLeak.h"
#import "NSObject+MemoryLeak.h"
@implementation UITextField (MemoryLeak)
- (BOOL)willDealloc {
return NO;
}
@end 很喜欢这个检测工具,望能修复 |
2018-01-05 20:19:08.907351+0800 TuyaSmartPublic[15439:7965494] Memory Leak: ( |
我这里也出现了报UITextField内存泄露的问题,楼上有同学提供了一种解决11.2误报的思路非常的好,但是其实框架的提供者有为我们提供了一个更好的解决方法:就是白名单,我们可以把UITextField加入到白名单内就好了,提供我的修改建议,在框架的NSObject+MemoryLeak.m 这个文件下 ,第114行的函数就是返回白名单数组,在这个方法里面添加2行代码,判断一下当前版本是否是11以上,然后将UITextField加入白名单即可,这样不必添加分类,iOS11以下也能监测UITextField的内存泄漏问题 + (NSMutableSet *)classNamesWhitelist {
static NSMutableSet *whitelist = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
whitelist = [NSMutableSet setWithObjects:
@"UIFieldEditor", // UIAlertControllerTextField
@"UINavigationBar",
@"_UIAlertControllerActionView",
@"_UIVisualEffectBackdropView",
nil];
// System's bug since iOS 10 and not fixed yet up to this ci.
NSString *systemVersion = [UIDevice currentDevice].systemVersion;
if ([systemVersion compare:@"10.0" options:NSNumericSearch] != NSOrderedAscending) {
[whitelist addObject:@"UISwitch"];
}
// 将UITextField加入白名单
if ([systemVersion compare:@"11.0" options:NSNumericSearch] != NSOrderedAscending) {
[whitelist addObject:@"UITextField"];
}
});
return whitelist;
} |
https://forums.developer.apple.com/thread/94323 UITextField在11.2会报内存泄露,实锤是苹果系统的bug,楼主的框架非常准确,它就是内存泄露了~👍👍👍 |
楼上正解. close. |
正解 |
以上代码会内存泄漏在iOS 12+ |
ios自身的问题,参考上面的代码屏蔽 |
将textfield 的autocorrectionType属性设置为NO,亲测有效! |
神了 |
iOS15上 autocorrectionType = NO也无效,只有一进来不调用becomeFirstResponder |
keyboardType = .emailAddress会释放,keyboardType = .numberPad不会释放 |
是的 坑爹啊 😭 |
when i set keboardType = .emailAddress or .numbersAndPunctuation, .namePhonePad I am running into this issue too, can anyone solve this problem? |
怎么解决这个问题的啊 |
您好, 首先感谢分享这么棒的工具.
测试当中, 打断点到控制器的dealloc, 发现可以正常走到dealloc, 但MLeaksFinder会报Memory Leak. 请问这是误报还是会受什么因素影响
The text was updated successfully, but these errors were encountered: