When is the autorelease object released?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP

When is the autorelease object released?



I tested it with the following code,and I found that the autorelease objc never release.
```


__weak id ref;
@implementation ViewController
- (void)viewDidLoad
[super viewDidLoad];
NSString *str = [NSString stringWithFormat:@"test"]; // add autoreleasePool
ref = str;

- (void)viewWillAppear:(BOOL)animated
[super viewWillAppear:animated];
NSLog(@"viewWillAppear:%@",ref); // result test

- (void)viewDidAppear:(BOOL)animated
[super viewDidAppear:animated];
NSLog(@"viewDidAppear:%@",ref); // result test

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
NSLog(@"%@",ref); // If I click long after,But it has not been released



```









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Comments

Popular posts from this blog

Executable numpy error

Trying to Print Gridster Items to PDF without overlapping contents

Mass disable jenkins jobs