[Mesa-dev] [Bug 73392] New: GLX context memory leak if context was bound to drawable on thread exit

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Wed Jan 8 03:12:56 PST 2014


https://bugs.freedesktop.org/show_bug.cgi?id=73392

          Priority: medium
            Bug ID: 73392
          Assignee: mesa-dev at lists.freedesktop.org
           Summary: GLX context memory leak if context was bound to
                    drawable on thread exit
          Severity: normal
    Classification: Unclassified
                OS: Linux (All)
          Reporter: ibragimovrinat at mail.ru
          Hardware: All
            Status: NEW
           Version: 9.2
         Component: GLX
           Product: Mesa

glXDestroyContext leaks memory if context was bound and there was no
glXMakeCurrent call before thread termination.

Here is sample code for reproduction.


// gcc glXDestroyContext-memleak.c -std=gnu99 -lpthread -lGL -lX11
#include <pthread.h>
#include <GL/glx.h>
#include <unistd.h>

GLXContext glc;
GLXContext root_glc;
Display *dpy;
XVisualInfo *xvi;

void *thread_func1(void *p)
{
    Window root_wnd = XDefaultRootWindow(dpy);
    glc = glXCreateContext(dpy, xvi, NULL, GL_TRUE);
    glXMakeCurrent(dpy, root_wnd, glc);
    glXDestroyContext(dpy, glc);
    return NULL;
}

int main(void) {
    GLint att[] = { GLX_RGBA, GLX_DEPTH_SIZE, 24, GLX_DOUBLEBUFFER, None };
    dpy = XOpenDisplay(NULL);
    xvi = glXChooseVisual(dpy, 0, att);

    for (int k = 0; k < 30000; k ++) {
        pthread_t t;
        pthread_create(&t, NULL, thread_func1, NULL);
        pthread_join(t, NULL);
        sleep(1);
    }

    return 0;
}

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140108/47377559/attachment.html>


More information about the mesa-dev mailing list