Texture allocations being doubled in iPhone OpenGL ES
- by Kyle
The below couple lines are called 15 times during initialization. The tx-size is reported at 512 everytime, so this will allocate a 1mb image in memory 15 times, for a total of 15mb used.. However, I noticed instruments is reporting a total of 31 allocations! (15*2)+1
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tx-size, tx-size, 0, GL_RGBA, GL_UNSIGNED_BYTE, spriteData);
free(spriteData);
Likewise in another area of my program that allocates 6 256x256x4 (256kB) textures.. I see 13 sitting there. (6*2)+1
Anyone know what's going on here? It seems like awful memory management, and I really hope it's my fault.
Just to let everyone know, I'm on the simulator.