iOS OpenGLES memory issue

Started by
2 comments, last by Tachikoma 12 years, 3 months ago
I am a novice iOS OpenGLES developer and am working on a app for publication. I noticed in any of the OpenGLES code for the iPhone I've downloaded, compiled, and ran showed a continuous increase in the 'live bytes' and 'total memory' values in the Allocation Instrument of the Instruments app. Memory usage jumps (5 - 10 kb) every time a presentRenderBuffer is called, which can add up pretty fast when frames are refreshed 60 times a second. Any thoughts would be appreciate in advance.
Advertisement
I've never had problem with presenting render buffer but I cannot tell this should not happened on different iOS version but I think your problem should be elsewhere
Are you using device or simulator? Sometimes simulator produce some garbage
If you are sure that presenting buffer is problem than you should report bug
But first think I should try is to present render buffer in loop with no other operation (only [myView presentRenderBuffer] ) with break point at end
You should also check for event which calls your render buffer creation
If you are using iOS 5 you should also read about ARC
Are you by chance creating a new framebuffer each frame accidentally? If you're drawing into a 32 bit pixel format at 480x320, that could account for the 5kb increase you're seeing. I would also try setting the [color=#666666][font=Courier, Consolas, monospace]

kEAGLDrawablePropertyRetainedBacking[/font] property on your EAGLDrawable to NO.

I would agree that presentRenderBuffer is most likely not your problem. It just be might that the presentRenderBuffer triggers a context flush, so you eoulf be seeing the effects of your previous gl* calls as well which means all of your GLES code should be suspect.

[color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif]

Are you by chance creating a new framebuffer each frame accidentally? If you're drawing into a 32 bit pixel format at 480x320, that could account for the 5kb increase you're seeing. I would also try setting the

[/font][color=#666666][font=helvetica, arial, verdana, tahoma, sans-serif]

[font=Courier, Consolas, monospace]

kEAGLDrawablePropertyRetainedBacking[/font]

[/font][color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif]

property on your EAGLDrawable to NO.

[/font]

[color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif]

I would agree that presentRenderBuffer is most likely not your problem. It just be might that the presentRenderBuffer triggers a context flush, so you would be seeing the effects of your previous gl* calls as well -- which means all of your GLES code should be suspect.

[/font]

Check that you are not creating new textures and VBOs at each frame. My strategy for these kinds of issues is to divide and conquer. Comment out everything in your render code and then start enabling stuff one by one until the problem presents itself.
Latest project: Sideways Racing on the iPad

This topic is closed to new replies.

Advertisement