I have a java applet that loads开发者_运维问答 up a scroll view that you can add several thousand views to, everything works fine. If I close that browser window and open a new window and view my applet again and start adding views it eventually runs out of memory. It seems like garbage collection didn't occur when I closed the window before:
a: why isn't memory freed once I close the window?
b: how can I make sure it is freed?
This is the latest version of java with FF and Safari.
It may be that the Java Browser Plugin can launch the applets in the same JVM. There is a applet parameter that you can use to launch your applet in a seperate JVM every time its launched in a new window:
<param name="separate_jvm" value="true">
Also you could leverage the start()
, stop()
and destroy()
methods of you applet to clean up resources you are using.
There are some interesting facts about the java plugin. Check the forum. It has some important links
Without seeing the code, my guess would be a reference to the window or one of it's components in your code which keeps it reachable.
精彩评论