Iphone Texture Problem/Memory Problem. Please help!
category: general [glöplog]
Hey guys,
i am really confused. i have got a memory problem and can't find a solution. i am writing an app for the iphone where i have to load many different textures. so i load them when i need them and release them if they are not needed.
i checked the allocations with Instruments. Now the weird thing:
ObjectAlloc tells me i have just 3.33 Mb allocated but Activity Monitor (which is the more important one i guess) tells me i am using 36.89 Mb memory.
And i need to load more textures than 3.33 Mb and than the memory will increase even more. i attached an example image of instruments.
I am using the Texture2D Class from Apple.
even if i release an object/texture, it seems that something stay in the memory.
but just in the activity monitor, in the objectalloc the memory was freed correctly.
if i alloc the same texture again, the same amount of memory is used as before.
problem is, i have got a lot of textures and if there stays something in the memory from every texture the memory is exploding.
what i am doing wrong? please help me? it kills me!
thx for all your help
vmp510
i am really confused. i have got a memory problem and can't find a solution. i am writing an app for the iphone where i have to load many different textures. so i load them when i need them and release them if they are not needed.
i checked the allocations with Instruments. Now the weird thing:
ObjectAlloc tells me i have just 3.33 Mb allocated but Activity Monitor (which is the more important one i guess) tells me i am using 36.89 Mb memory.
And i need to load more textures than 3.33 Mb and than the memory will increase even more. i attached an example image of instruments.
I am using the Texture2D Class from Apple.
even if i release an object/texture, it seems that something stay in the memory.
but just in the activity monitor, in the objectalloc the memory was freed correctly.
if i alloc the same texture again, the same amount of memory is used as before.
problem is, i have got a lot of textures and if there stays something in the memory from every texture the memory is exploding.
what i am doing wrong? please help me? it kills me!
thx for all your help
vmp510
Sounds like you're loading the image into memory, then just allocating/releasing the texture - are you actually unloading the image file too?
Also, keep in mind that the GPU on the iPhone is a deferred renderer, and thus needs to keep texture data until the frame is rendered. Have you tried issuing a glFinish() after deleting the textures?
i've found an answer in another forum
http://www.iphonedevsdk.com/forum/iphone-sdk-development/7363-opengl-texture2d-wont-deallocate.html
psonice solved the problem too :)
http://www.iphonedevsdk.com/forum/iphone-sdk-development/7363-opengl-texture2d-wont-deallocate.html
psonice solved the problem too :)