Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4365340

memory leak caused by awt FreeDrawingSurface

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 1.4.0
    • 1.2.0, 1.3.0, 1.4.0
    • client-libs
    • None
    • beta
    • sparc
    • solaris_7

      Note that this problem does not happen on Solaris, it happens only
      on windows with JDK1.3 and JDK1.4beta releases.


      To reproduce:

      run the attached test program, hit the "reload" button many times, notice the
      reported growing heap memory usage.

      Every time the "reload" button is selected, a Canvas3D object is
      removed from the frame, a new canvas3D object is created and added to the frame.

      The Canvas3D object overrides the Canvas's "paint" method to include
      essentially the following additional code when the paint method is called
      for the first time:
          ds = awt->GetDrawingSurface(env, canvas);

      and the removeNotify method is overrided to include:
          awt->FreeDrawingSurface(ds);


      Without the above changes, the heap usage remains mostly contant when running
      the test program with many reloads. This seems to indicate that the
      awt->FreeDrawingSurface(ds) fails to cleanup properly.

      Furthermore, Optimizeit reveals that there is a JNI global reference to
      each of the previously removed Canvas3D objects.


      To run the test program,

      assuming network drive is h:

      set CLASSPATH=h:\law\export\home\chow\java3d1.2.1pc\build\win32\release\ogl\optlib\ext\j3dcore.jar
      set CLASSPATH=h:\law\export\home\chow\java3d1.2.1pc\build\win32\release\ogl\optlib\ext\j3daudio.jar;%CLASSPATH%
      set CLASSPATH=h:\law\export\home\chow\java3d1.2.1pc\build\win32\release\ogl\optlib\ext\vecmath.jar;%CLASSPATH%
      set CLASSPATH=h:\law\export\home\chow\java3d1.2.1pc\build\win32\release\ogl\optlib\ext\j3dutils.jar;%CLASSPATH%
      set CLASSPATH=.;%JAVAHOME%\lib;%CLASSPATH%
      set PATH=h:\law\export\home\chow\java3d1.2.1pc\build\win32\release\ogl\opt\bin;%
      PATH%
      set PATH=%JAVAHOME%\bin;%PATH%

            mmartaksunw Michael Martak (Inactive)
            lkchow Lawrence Chow
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: