Texture allocations being doubled in iPhone OpenGL ES

Posted by Kyle on Stack Overflow See other posts from Stack Overflow or by Kyle
Published on 2010-03-22T02:05:39Z Indexed on 2010/03/22 2:11 UTC
Read the original article Hit count: 314

Filed under:
|
|
|

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.

© Stack Overflow or respective owner

Related posts about opengl-es

Related posts about iphone