Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Memory is not fully released using wglDeleteContext

125 views
Skip to first unread message

Yael Weinbach

unread,
Jun 27, 1999, 3:00:00 AM6/27/99
to
Hello,

1. It seems that using wglDeleteContext does not free all the memory
allocated by wglCreateContext. For example in the following code,
part of the memory allocated in wglCreateContext leaks :

HDC hDC = ::GetDC(hWnd);
HGLRC hGLContext = wglCreateContext(hDC);
wglMakeCurrent(hDC,hGLContext);
...
wglMakeCurrent(NULL,NULL);
wglDeleteContext(hGLContext);
::ReleaseDC(hWnd,hDC);

Could someone tell me how to release all the memory ?

2. I'm writing an application with multiple gl windows (using
Visual C++ 6.0). Is there a way of implementing application
like this without keeping multiple rendering contexts in memory ?

Thanks

Yael

Nick

unread,
Jun 27, 1999, 3:00:00 AM6/27/99
to
I am having the exact same problem when attempting to use dynamic binding of
the GL driver. wglDeleteContext doesn't free all the memory allocated with
CreateContext. Can anyone shed some light on this?

-Nick

Yael Weinbach <ya...@biomedicom.co.il> wrote in message
news:377642AD...@biomedicom.co.il...

JL Martinez

unread,
Jun 28, 1999, 3:00:00 AM6/28/99
to
Which is your 3D chip ?

Nick wrote in message ...

Paul Martz

unread,
Jun 28, 1999, 3:00:00 AM6/28/99
to
Yael Weinbach wrote in message <377642AD...@biomedicom.co.il>...

>Hello,
>
>1. It seems that using wglDeleteContext does not free all the memory
> allocated by wglCreateContext. For example in the following code,
> part of the memory allocated in wglCreateContext leaks :

Try creating and deleting several contexts in a loop. If you see a
substantial memory leak from doing this, it is probably a bug which should
be reported to your vendor.

> HDC hDC = ::GetDC(hWnd);
> HGLRC hGLContext = wglCreateContext(hDC);
> wglMakeCurrent(hDC,hGLContext);
> ...
> wglMakeCurrent(NULL,NULL);
> wglDeleteContext(hGLContext);
> ::ReleaseDC(hWnd,hDC);

Losing some memory after a single create-delete pair may not be a butg,
depending on how your implementation works.

> Could someone tell me how to release all the memory ?
>
>2. I'm writing an application with multiple gl windows (using
> Visual C++ 6.0). Is there a way of implementing application
> like this without keeping multiple rendering contexts in memory ?

Just use one context instead of multiple contexts. All your windows will
need to use the same pixel depth, attributes (such as Z buffer), etc.

-Paul Martz
Hewlett Packard Workstation Systems Lab
To reply, remove "DONTSPAM" from email address.

JL Martinez

unread,
Jun 29, 1999, 3:00:00 AM6/29/99
to
I Have also the same problem but only with TNT based card.
I,ve already tried to use a single RC shared by multiple DC with same PF
as Paul suggest but the leak are still here (allocation seems to occur when
making the DC-RC pair current)

Paul Martz wrote in message <7l8crn$s44$1...@fcnews.fc.hp.com>...

0 new messages