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

Applet heap memory - OutOfMemoryError

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 6
    • deploy
    • generic
    • generic

      There is something weird going on with applet heap memory. This first came up in the following JAI forum thread:
        http://forums.java.net/jive/thread.jspa?threadID=23250&tstart=0

      The reporter in that thread provided a simple applet and htm. I modified it to display memory usage - see attached codes. Also attached, Java console output from running this applet using JDK 1.6.0 b105 on the following environments:
       1) Windows XP (both IE and FF)
       2) Fedora Core6 Linux (32-bit, FF only)
       3) Solaris 10 (64-bit, FF only)

      How to reproduce the issue
       o compile the code,
       o place the HTM and CLASS files together in a web server docs folder somewhere
       o ensure the Java Plugin has standard -Xmx64m setup, and that Java Console will open
       o open your browser (ensure Java Console is open) then navigate to the HTM file
       o once the applet finishes loading, press the browser refresh button
       o repeat the above step several times

      What happens
       o when the appelt init()s it creates an array of bytes of size 55Mb
       o In the console, you'll see free/total heap memory used by the applet at each applet "lifecycle stage" (init, start, stop, destroy) as well as a list of applets in the applet context.
       o there is an OutOfMemoryError straight after the first time you try to refresh on all systems.
       
      What is expected
       o the 55Mb array should be cleanly GC'ed after Applet/destroy() is called
       o no OutOfMemoryError
       o total heap memory shouldn't be increasing like that

            ccheung Calvin Cheung
            tyao Ting-Yun Ingrid Yao (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: