Ios CGImage导致内存泄漏
我正在使用以下代码创建cgimage:Ios CGImage导致内存泄漏,ios,objective-c,xcode,automatic-ref-counting,instruments,Ios,Objective C,Xcode,Automatic Ref Counting,Instruments,我正在使用以下代码创建cgimage: UIGraphicsBeginImageContext(CGSizeMake(size*2, size*2)); CGContextRef ctx = UIGraphicsGetCurrentContext(); [[SKColor colorWithWhite:0.8 alpha:1] setFill]; CGContextFillEllipseInRect(ctx, CGRectMake(0, 0, size*2, size*2)); UIImag
UIGraphicsBeginImageContext(CGSizeMake(size*2, size*2));
CGContextRef ctx = UIGraphicsGetCurrentContext();
[[SKColor colorWithWhite:0.8 alpha:1] setFill];
CGContextFillEllipseInRect(ctx, CGRectMake(0, 0, size*2, size*2));
UIImage *textureImage = UIGraphicsGetImageFromCurrentImageContext();
SKTexture *texture = [SKTexture textureWithImage:textureImage];
SKSpriteNode *node = [SKSpriteNode spriteNodeWithTexture:texture];
显然,这是问题的根源
我试着把它包装在一个自动释放块中,试着释放cgimageref,但我使用的是ARC,所以它们实际上什么都不做。发生了什么事
我想你可能需要打个电话来清理一下 另外,在创建SKTexture对象后,将“
textureImage
”设置为nil,看看这是否有帮助