Amazing memory leak when adding image to contact on iOS

I currently have a leak on this line in the tools, I leak several hundred K every time this is called -

NSData *dataRef = UIImagePNGRepresentation([UIImage imageNamed:@"Icon.png"]);
ABPersonSetImageData(newRecord, (CFDataRef)dataRef, nil);

When I exit the lines above, I'm fine.

dataRef is only mentioned here throughout the program. I tried CFrelease-it as a test, but this causes a crash due to a reference to an object not allocated.

I tried to combine all this into one line,

ABPersonSetImageData(newRecord,(CFDataRef) UIImagePNGRepresentation([UIImage imageNamed:@"Icon.png"]), nil);

but I got the same results.

I would prefer a leak for the first time since Imagenamed is known to cache the image object, and was reportedly tested by pre-iOS4, but I would not expect any current leaks.

Any ideas? related questions were raised here several times, but no one seemed to answer.

+3
1

, . UIImagePNGRepresentation autoreleased, . dataRef autoreleased, .

+1

Source: https://habr.com/ru/post/1792792/


All Articles