Imagination PowerVR SDK Blog

eglDestroySurface() doesn't free memory on LinuxPC


I’ve been trying to track down a memory leak & found it is due to the fact that eglDestroySurface() doesn’t release any memory.

I do the following:

1) Create and map an X window

2) Create a window surface for the X window

3) Create a context for the window surface

4) Make the window’s context current

5) Create a pbuffer surface

6) Create a context for that pbuffer surface

7) Make the pbuffer context current (with the pbuffer surface)


9) Make the window’s context current again (with window surface)

10) Delete the pbuffer context

11) Delete the pbuffer surface

12) repeat 5-11

It doesn’t matter how large the pbuffer is, eglCreatePBufferSurface always allocates ~1.1M, so the VmRss & VmSize both increase by 1.1M each time I create & destroy a pbuffer. After a few seconds the program aborts with:

"X Error of failed request: BadAlloc (insufficient resources for operation)"

I can post some example code, if required.


Hi Tom,

thanks for reporting this. We’re looking into the problem.


Hi Tom,

Thank you very much for this detailed report, I’ll take a look at it and try to fix it before the next release.