<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://jogamp.org/bugzilla/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.2"
          urlbase="https://jogamp.org/bugzilla/"
          
          maintainer="sgothel@jausoft.com"
>

    <bug>
          <bug_id>166</bug_id>
          
          <creation_ts>2005-06-22 12:25:22 +0200</creation_ts>
          <short_desc>Memory leak with ATI Mobility Radeon 9700</short_desc>
          <delta_ts>2010-03-24 07:47:54 +0100</delta_ts>
          <reporter_accessible>0</reporter_accessible>
          <cclist_accessible>0</cclist_accessible>
          <classification_id>3</classification_id>
          <classification>JogAmp</classification>
          <product>Jogl</product>
          <component>core</component>
          <version>1</version>
          <rep_platform>All</rep_platform>
          <op_sys>all</op_sys>
          <bug_status>VERIFIED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Sven Gothel">sgothel</reporter>
          <assigned_to name="Sven Gothel">sgothel</assigned_to>
          
          
          <cf_type>DEFECT</cf_type>
          <cf_scm_refs></cf_scm_refs>
          <cf_workaround>---</cf_workaround>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>182</commentid>
    <comment_count>0</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2010-03-24 07:47:54 +0100</bug_when>
    <thetext>


---- 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 &quot;JOGL is slowly
increasing memory usage! WHY?&quot;:
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&apos;s and LWJGL&apos;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&apos;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 &quot;makeCurrent/free&quot; 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&apos;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&apos;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&apos;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 is unknown.
   Reassigning to the person who moved it here: sgothel@jausoft.com.
The original submitter of attachment 60 is unknown.
   Reassigning to the person who moved it here: sgothel@jausoft.com.

</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>59</attachid>
            <date>2005-06-22 00:26:00 +0200</date>
            <delta_ts>2005-06-22 00:26:00 +0200</delta_ts>
            <desc>Main program of test case</desc>
            <filename>AnimJOGLApp.java</filename>
            <type>text/plain</type>
            <size>896</size>
            <attacher name="Sven Gothel">sgothel</attacher>
            
              <data encoding="base64">DQppbXBvcnQgamF2YS5hd3QuKjsNCmltcG9ydCBqYXZhLmF3dC5ldmVudC4qOw0KDQppbXBvcnQg
bmV0LmphdmEuZ2FtZXMuam9nbC4qOw0KDQpwdWJsaWMgY2xhc3MgQW5pbUpPR0xBcHANCnsNCiAg
c3RhdGljIEFuaW1hdG9yIGFuaW1hdG9yOw0KDQogIHB1YmxpYyBzdGF0aWMgdm9pZCBtYWluKFN0
cmluZ1tdIGFyZ3MpDQogIHsNCiAgICBGcmFtZSBmcmFtZSA9IG5ldyBGcmFtZSgiQW5pbUpPR0xB
cHAiKTsNCiAgICAvL0FuaW1hdG9yIGb8ciBCZXdlZ3VuZw0KDQoNCiAgICAvL0dMQ2FudmFzIGb8
ciBBbnplaWdlDQogICAgR0xDYW52YXMgY2FudmFzID0gR0xEcmF3YWJsZUZhY3RvcnkuZ2V0RmFj
dG9yeSgpLmNyZWF0ZUdMQ2FudmFzKG5ldyBHTENhcGFiaWxpdGllcygpKTsNCiAgICBjYW52YXMu
YWRkR0xFdmVudExpc3RlbmVyKG5ldyBBbmltR0xFdmVudExpc3RlbmVyKCkpOw0KICAgIGZyYW1l
LmFkZChjYW52YXMpOw0KDQogICAgLy9BbmltYXRvciBtaXQgWmVpY2hlbmZs5GNoZSBpbml0aWFs
aXNpZXJlbg0KICAgIGFuaW1hdG9yID0gbmV3IEFuaW1hdG9yKGNhbnZhcyk7DQoNCiAgICBmcmFt
ZS5zZXRTaXplKCA0MDAsDQogICAgICAgICAgICAgICAgICAgNDAwKTsNCiAgICBmcmFtZS5hZGRX
aW5kb3dMaXN0ZW5lcihuZXcgV2luZG93QWRhcHRlcigpDQogICAgICB7DQogICAgICAgIHB1Ymxp
YyB2b2lkIHdpbmRvd0Nsb3NpbmcoV2luZG93RXZlbnQgZSkNCiAgICAgICAgew0KICAgICAgICAg
IGFuaW1hdG9yLnN0b3AoKTsNCiAgICAgICAgICBTeXN0ZW0uZXhpdCgwKTsNCiAgICAgICAgfQ0K
ICAgICAgfSk7DQoNCiAgICBmcmFtZS5zZXRWaXNpYmxlKHRydWUpOw0KICAgIC8vQW5pbWF0aW9u
IHN0YXJ0ZW4NCiAgICBhbmltYXRvci5zdGFydCgpOw0KICB9DQp9DQo=
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>60</attachid>
            <date>2005-06-22 00:26:00 +0200</date>
            <delta_ts>2005-06-22 00:26:00 +0200</delta_ts>
            <desc>GLEventListener for test case</desc>
            <filename>AnimGLEventListener.java</filename>
            <type>text/plain</type>
            <size>1456</size>
            <attacher name="Sven Gothel">sgothel</attacher>
            
              <data encoding="base64">aW1wb3J0IG5ldC5qYXZhLmdhbWVzLmpvZ2wuKjsNCg0KcHVibGljIGNsYXNzIEFuaW1HTEV2ZW50
TGlzdGVuZXIgaW1wbGVtZW50cyBHTEV2ZW50TGlzdGVuZXINCnsNCg0KICBmbG9hdCB0cmkgPSAw
LjBmOw0KDQoNCiAgcHVibGljIHZvaWQgaW5pdChHTERyYXdhYmxlIGRyYXdhYmxlKQ0KICB7DQog
ICAgR0wgZ2wgPSBkcmF3YWJsZS5nZXRHTCgpOw0KICAgIGdsLnNldFN3YXBJbnRlcnZhbCgwKTsN
CiAgfQ0KDQogIHB1YmxpYyB2b2lkIGRpc3BsYXkoR0xEcmF3YWJsZSBkcmF3YWJsZSkNCiAgew0K
ICAgIEdMIGdsID0gZHJhd2FibGUuZ2V0R0woKTsNCiAgICBnbC5nbE1hdHJpeE1vZGUoR0wuR0xf
TU9ERUxWSUVXKTsNCiAgICBnbC5nbENsZWFyKEdMLkdMX0NPTE9SX0JVRkZFUl9CSVQgfCBHTC5H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