glReadPixels() memory leak in opengles?
I encounter glReadPixels memory leak issue.Please See the image attached
Screen Shot 2014-08-20 at 2.03.55 PM.jpg
notice the area marked with red lines.malloc free pair memory is OK,but an extra 3M memory is allocated by glReadPixels, I have read from doc glReadPixels official doc
which has not mentioned any mem alloc information by glReadPixels. So,does glReadPixels really allocate memory.If so, how to free it?
OpenGL ES drivers are free to allocate whatever memory they need for talking to HW - and this is totally platform specific. Such memory is to be freed by driver - it is not specified when exactly, but not later than GL context destruction. Some GL commands (especially draws) does not finish processing when they return - so the allocations are kept until their are done. From user space perspective these may look like a leak, but it is not.
I would imagine that glReadPixels (and other pixel transfer functions, like glTexImage*) alloc some temp memory for staging buffers, used to copy data from/to GPU memory.
However, if you see persistent leaking leading to memory exhaustion you should get in touch witch GPU/platform vendor - possibly reporting a bug.
Tags for this Thread