Applet calling javascript function causing memory leak
Hi,
I'm troubleshooting one memory leak issue in my application and to do that I created one simple Java applet and HTML + javascript function to locate the problem.
Basically it's an applet calling a javascript function using a timer. The javascript function simply does nothing.
I tested in IE 8.0 and JRE 1.6.0_23-b05 and memory of IE keeps increasing.
I saw this bug http://bugs.sun.com/view_bug.do?bug_id=6857340 which seems related with my issue, but if I understand correctly from the page, the issue should have been fixed.
I posted this message to find out if others also find same issue and if there's a solution for this. If I comment out window.call("dummy", null); , memory will not climb up.
Java code
+public class Main extends Applet implements Runnable {+
public Applet currentApplet= this ;
+ public JSObject window = null;+
+public void run(){+
+ System.out.println("run..");+
+ }+
+public void start(){+
window = JSObject.getWindow(this);
int delay = 300; //milliseconds
+ActionListener taskPerformer = new ActionListener() {+
+public void actionPerformed(ActionEvent evt) {+
window.call("dummy", null);
+}+
+};+
new Timer(delay, taskPerformer).start();
+ }+
+public static void main(String[] args) {+
+ System.out.println("start...");+
+ Main main = new Main();+
+ main.start();+
+ }+
+}+
Javascript source code
+<html>+
+<head>+
+<script>+
+function dummy() {+
+ +
+}+
+</script>+
+</head>+
+<body>+
+<applet .... >+
+...+
+</html>+