---- Reported by kbr 2005-06-22 00:25:22 ---- A very simple test case reported by a user on the javagaming.org JOGL forum was shown to leak memory when run with JOGL 1.1 b12 on ATI Mobility Radeon 9700 hardware on Windows XP with recent drivers. The test case is attached and can also be found in the following thread on javagaming.org (called "JOGL is slowly increasing memory usage! WHY?": http://192.18.37.44/forums/index.php?topic=9865.0 The same test case when ported to LWJGL does not exhibit the memory leak. The difference in behavior lies in JOGL's and LWJGL's OpenGL context management. When JOGL performs an OpenGL repaint cycle in the GLCanvas (on Windows), it locks the surface using the JAWT, makes the OpenGL context current on the resulting HDC, performs the user's rendering, releases the current OpenGL context, and unlocks the surface. The current implementation of LWJGL behaves similarly, but does not release the current OpenGL context before unlocking the surface, and before making the OpenGL context current on the HDC checks to see whether it is already current. This skips the "makeCurrent/free" pattern of the OpenGL context on all but the first paint cycle, possibly for performance reasons. It can be argued that this OpenGL context management is not completely correct, because if the OpenGL context was desired to be operated upon from another thread it would have to cooperatively be released from the thread upon which it was previously made current. In the general case this is not possible. It turns out there is a real bug in ATI's drivers causing memory to be leaked on this particular mobile chip (and perhaps others) during each makeCurrent/free cycle. This is the root cause of the memory leak with the JOGL program and why the LWJGL port of the same program does not leak memory. ---- Additional Comments From kbr 2005-06-22 00:26:13 ---- Created an attachment Main program of test case ---- Additional Comments From kbr 2005-06-22 00:26:59 ---- Created an attachment GLEventListener for test case ---- Additional Comments From kbr 2005-06-22 01:06:20 ---- Worked around memory leak in ATI's OpenGL drivers by adding system property -Djogl.GLContext.nofree which users can specify on the command line. There is no good general-purpose workaround for this bug which works well on all hardware and in all kinds of applications. Issues may remain if this workaround is used and if the GLCanvas is removed and re-added to its parent container. Use at your own risk. ---- Additional Comments From kbr 2005-06-22 01:11:01 ---- I should also mention that a bug has been filed with ATI's Customer Support Ticket system. --- Bug imported by sgothel@jausoft.com 2010-03-24 07:47 EDT --- This bug was previously known as _bug_ 166 at https://jogl.dev.java.net/bugs/show_bug.cgi?id=166 Imported an attachment (id=59) Imported an attachment (id=60) The original submitter of attachment 59 [details] is unknown. Reassigning to the person who moved it here: sgothel@jausoft.com. The original submitter of attachment 60 [details] is unknown. Reassigning to the person who moved it here: sgothel@jausoft.com.