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
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
- duplicates
-
JDK-6399750 RFE: Improve applet lifecycle and LiveConnect support in Java Plug-in
- Closed
- relates to
-
JDK-6480410 Thread leak in applets
- Closed
-
JDK-6462598 thread leaking in IE fast open and close of applet
- Closed
-
JDK-6550586 JApplet Memory Not Released When Reloading Pages
- Closed