PNG memory leak question

Nibbie
Posts: 1
Joined: 2009.08
Post: #1
Hi,

I'm new to iphone development, so I hope this isn't a foolish question.

I've been trying to track down a memory leak, and I've run across something strange. In my test code, I create a simple UIView with a button image, drawRect is called once to render the button image, the UIView (and it's UIImage) are released on touchesEnded. The code then recreates the UIView, it renders, is released on a touch input. This repeats over and over...

The strange thing is that my memory usage increases over time if the png has alpha, otherwise it stays the same. If I comment out drawRect, the memory stops leaking.

- (void)drawRect:(CGRect)rect {

[BtnImage drawAtPoint:CGPointZero];
}


I've gotten the same results using multiple different png's with alpha, including those provided by Apple for samples.

Does anyone know why PNGs with alpha would cause a memory leak where PNGs w/ out alpha don't?

On a related note, is there any way to print the available system memory to the console output (in code)?

Thanks,
Jon
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Memory leak via obj-c markhula 4 4,851 Apr 17, 2011 01:35 PM
Last Post: SethWillits
  Why Does OpenGLES Appear To Leak Memory? muleskinner 2 3,518 Oct 22, 2009 04:54 AM
Last Post: muleskinner
  Memory Leak using stringWithFormat MikeD 6 6,109 Apr 13, 2009 08:30 AM
Last Post: MikeD