views:

454

answers:

1

Is there a way to programmatically check the OpenGL ES texture memory usage on the iPhone?

I know you can use Instruments to monitor it, but I would like to do in in the app is possible.

A: 

Hi lajos,

I don't think there's a built-in way to do this. Have you considered writing your own functions to malloc and free texture memory? I imagine you use malloc() to create memory for each texture. You could create another function that called through to malloc and also logged the amount of memory being allocated. It'd be a very primitive way of tracking the texture memory, but it'd be fast!

Ben Gotow
Ben: Thanks for the suggestion. I considered that, but UIImages can also be stored in the texture memory. I can track all my textures, but I don't know how to track textures from UIImage. So I'm hoping that there is a way to do this from the SDK.
lajos
Mixing OpenGL and UIKit leads to all sorts of fun issues such as the one you noted. :)However, overall memory usage is usually a problem before you hit the 24mb? limit on textures.
Andrew Pouliot