The 'returnArray' you specified is outside the autocomplete pool block. Now you add your image to the "temp" dictionary, which is inside the auto-release pool, but in the end you add this "temp" to the "returnArray", and therefore it increases the number of holds that actually causes a leak.
Even if you are working with images, keep one more thing in mind. When you use an image, it does not accept in memory what it shows as the file size, as many would expect (i.e. Something less than 3 MB for 2048 x 1536). Instead, it actually loads in raw format, taking memory based on the calculation as follows:
width x height xn bytes, where n is the number of bits taken to represent colors per pixel, mostly 4.
therefore, for the same 2048 x 1536 image, it will take 12 MB.
So, now check what the original resolution of the image you are talking about is, and calculate how many MB it will need, and change your code accordingly.
source share