How many 1024*1024 pngs can be load in openGL for iphone without having the app crash

Approximately what’s the maximum number of 1024x1024 32 bit .pngs which can be loaded at the same time with openGL in iphone ?, without risk of the app crashing.

And .pvr ? a much higher number ?

If I need a huge amount of textures in my game, is healthy to keep loading and calling dealloc to not overload the memory with all the textures ?

This depends on the amount of memory in the iPhone, what else it’s using memory for, what else you’re loading to OpenGL (e.g buffer objects) whether or not the user has other apps running, transient conditions and various other factors. It’s impossible to answer this question with a single number.

For reference, a 1024x1024x32 PNG will be loaded to OpenGL as an uncompressed RGBA texture, so (assuming no mipmaps) a single such texture will consume 4mb of memory. Compressed formats (I don’t know PVR so I’m giving the figures for DXT here) will take between one-quarter and one-eighth the memory, as a tradeoff versus some quality loss.

Most games will only load the textures needed for the current level, and will unload them (using glDeleteTextures) when the level changes.