Eric, you were correct and I found my bug. It was working at another place so by comparing the two I managed to fix the memory leak issue.
Cheers, Thimeau > Le 23 mars 2017 à 01:20, Admin Free a écrit: > Hi Eric, > > I can confirm the image is not released, even by adding > HIImageViewSetImage(myView, NULL) like this > HIImageViewSetImage(myView, myImage1); // First image retained by the > view > CGImageRelease(myImage1); > // Now I need to replace the first image of the image view by another image > HIImageViewSetImage(myView, NULL); > HIImageViewSetImage(myView, myImage2); // Second image retained by the > view > CGImageRelease(myImage2); > > If you have any workaround I'm all ears! > > Cheers, > > Thimeau > > Le 23 mars 17 à 00:45, Eric Schlegel a écrit: >>> On Mar 22, 2017, at 8:37 AM, Thimeau wrote: >>> When calling HIImageViewSetImage() the image is retained by the view. So >>> How to make sure the retain image is being released before another image is >>> set by another call to HIImageViewSetImage(). >>> >>> Example: >>> HIImageViewSetImage(myView, myImage1); // First image retained by the >>> view >>> CGImageRelease(myImage1); >>> // Now I need to replace the first image of the image view by another image >>> HIImageViewSetImage(myView, myImage2); // Second image retained by the >>> view >>> CGImageRelease(myImage2); >>> >>> When doing this it appears that when setting the second image, >>> HIImageViewSetImage() doesn't release the first image creating a leak! Is >>> there a way to do this properly? >> >> I looked at the code and it looks to me that the HIImageViewSetImage >> _should_ release the image already associated with the image view. I haven’t >> written a test app to confirm this, however. >> >> If you can reproduce a problem with the image not being released, please >> file a bug with a test app that shows the problem, and I’ll take a look. >> Perhaps there’s a code path that I’m not seeing. I might be able to suggest >> a workaround if so. >> >> -eric _______________________________________________ Do not post admin requests to the list. They will be ignored. Carbon-dev mailing list (Carbon-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/carbon-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com