Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Applet calling javascript function causing memory leak

839448Feb 14 2011
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>+

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Mar 14 2011
Added on Feb 14 2011
0 comments
187 views