We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
我写了一个ViewController测试以下几种方式引发的内存漏泄,但是发现日志并没有检测结果,这是什么原因?
这个ViewController 是这样写的:
@interface TableView : NSObject @property(nonatomic) Byte *space; @property(nonatomic, copy) void (^block)(); -(void)sayHello; @end #define kTenMB 1048576 * 10 @implementation TableView - (instancetype)init { self = [super init]; if (self) { //分配 10MB 内存 self.space = malloc(kTenMB); memset(self.space, 0, kTenMB); } return self; } -(void)sayHello { NSLog(@"Hello!"); } - (void)dealloc { NSLog(@"=== %s",__func__); free(self.space); } @end @interface AViewController () @property(nonatomic, copy) void (^block)(); @property(nonatomic, strong) TableView *tableView; @end @implementation AViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. self.title = @"A"; self.view.backgroundColor = UIColor.greenColor; // ---- Block ,self leak ---- self.block = ^{ // [self test]; NSLog(@"== title:%@",self.title); }; self.block(); // ---- tableView leak ---- TableView *tableView = [TableView new]; tableView.block = ^{ [tableView sayHello]; }; } - (void)dealloc { NSLog(@"==== %s %@",__func__,self); } @end
在- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 也做了以下配置:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
[[OOMDetector getInstance] setupWithDefaultConfig]; // 开启内存泄漏监控 [[OOMDetector getInstance] setupLeakChecker];
The text was updated successfully, but these errors were encountered:
No branches or pull requests
我写了一个ViewController测试以下几种方式引发的内存漏泄,但是发现日志并没有检测结果,这是什么原因?
这个ViewController 是这样写的:
在
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
也做了以下配置:The text was updated successfully, but these errors were encountered: