Re: [info-performer] Solution memory leak caused by GetDC()

Date view Thread view Subject view Author view

From: Alexandre Naaman (naaman++at++laplace.engr.sgi.com)
Date: 04/23/2004 16:48:58


On Fri, 23 Apr 2004, Peter Krueger wrote:

Hi Peter,

 You're correct, we never call(ed) ReleaseDC() because we assumed that the
HWND used for rendering did in fact get created with the CS_OWNDC flag.

 That being said, considering that we do allow users to specify the HWND
to use, and that may have been created without this flag, I have added
some code to check for this and call ReleaseDC() if appropriate.

 I fired off a build and it was the very last check-in which made it into
Performer 3.1.1. Hopefully it does indeed fix your problem!

 Thanks for the detailed explanation,

Alex.

> Hello Performer/WIN32 developers at SGI!
> I've tried to find out why Performer has this memory leak problem with
> GetDC(). So I looked into the GTK-GlExt code to see what happens there and
> why GTK doesn't have this problem. I think I've found some relevant code.
>
> The flag need_release_dc is determined in the initialization phase of the
> GtkGlWidget. I think this could be placed in setWSWindow():
> BOOLEAN need_release_dc;
> // find out whether it is a private DC
> DWORD wndclass_style = GetClassLong (hwnd, GCL_STYLE);
> if (wndclass_style & CS_OWNDC) need_release_dc = FALSE;
> else need_release_dc = TRUE;
>
>
> When OpenGL shall be enabled the following is called and the hdc is stored
> for the finalization phase:
> hdc = GetDC (hwnd);
> wglMakeCurrent(hdc, hglrc);
>
>
> When all OpenGL calls are done for this frame the following is called:
> SwapBuffers (hdc);
> // the hdc is released now if necessary
> if (need_release_dc) ReleaseDC (hwnd, hdc);
>
> I hope this will help you to improve the Windows port of Performer and
> make it work whether the window has its own HDC or not.
>
> Regards,
> Peter
> --
> ====================================================================
> Peter Krüger
>
> applied software solutions (appss) GmbH
> Sandtorstr. 23
> D-39106 Magdeburg
> Germany
>
> Phone: +49-(0)391-54486-19388
> Fax: +49-(0)391-54486-19222
> email: krueger++at++appss.de
> URL: http://www.appss.de/
>
> Managing Director: Uwe Hess, Dietmar Schäfer
> Register: HRB12386, AG Magdeburg
>
> "Virtual business becomes reality!"
>
> This e-mail may contain confidential and/or privileged information. If
> you are not the intended recipient (or have received this e-mail in
> error) please notify the sender immediately and destroy this e-mail. Any
> unauthorised copying, disclosure or distribution of the material in this
> e-mail is strictly forbidden.
> ====================================================================


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Fri Apr 23 2004 - 16:50:44 PDT