We are loading image(s) from file(s) using initWithContentsOfFile. While the image(s) load properly we noticed that the memory our app is consuming is increasing even after calling a release on the loaded image(s).
We've observed this using Activity Monitor and looking at the memory our App is taking up.
Basically, the memory space is increase by the size of the image(s) we are loading (even after a release call). When our app starts up, it consumes maybe 20-30MB but as we start loading the images repeatedly and disposing this ends up growing to the Gigabyte range.
So, the question is how can we stop this memory leak from occurring?
Basically we are executing the following code and observing an increase in our app's memory usage footprint:
NSImage *image = [[NSImage alloc] initWithContentsOfFile:filepath]; [image release];