Closed Bug 298852 Opened 20 years ago Closed 16 years ago

memory leak calling netscape.javascript.JSObject.call in Java

Categories

(Core Graveyard :: Java: OJI, defect, P2)

x86
All
defect

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: hhschwab, Assigned: jst)

References

()

Details

(4 keywords)

Attachments

(3 files, 1 obsolete file)

I`ve been asked in Bug 215872 Browser crashes upon visiting qx.net
to file a new bug:

Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.8b2) Gecko/20050625
Java(TM) 2 Platform Standard Edition 5.0 Update 4

I'm testing the testcase, https://bugzilla.mozilla.org/attachment.cgi?id=12979
made from http://www.qx.net/
I'm using the freeware Process Explorer 9.10 from http://www.sysinternals.com/
View->System Information to observe CPU load and memory usage.

There seems to be a big slow memory leak.

The scroller is getting slower and slower, in the first minutes the CPU load
changes between 60% and 100%, after ten minutes lets say between 99 and 100%.
I lost 1 MB of RAM in 5 minutes, from 20 MB down to 19 MB.
Some earlier tests I only had 2000 KB, and it went down to a two-digit number,
then freezed. A Mah-Jong game had 6000 kb available.
I don´t mind the 100% CPU load, if it happens from time to time, as that
computer is a slow Celeron333 with 128 MB RAM running Win98 (not recommended for
Java 1.5) Crashes I see on this computer I also see on another running Win98SE
(recommended for Java 1.5), having a relatively fast Athlon XP1600+ and 512 MB
of RAM, and ample space on the harddisk. 

I don´t crash, but there definitely is a memory leak, though it takes minutes to
notice it.

When I´m waiting too long, I get a hang, Ctrl-Alt-Del isn´t accepted, I've got
to make a Reset. I also crashed once, but as that takes time, both waiting to
crash, and the reboot afterwards including a scan I try to avoid this.
Attached file testcase (obsolete) —
this leaks really fast with linux suite trunk 2005062505:

<applet id='dvsapp' code='dvstimer.class' MAYSCRIPT><PARAM NAME='delay'
VALUE='0'></applet>

class file is at http://www.qx.net/dvstimer.class
Attached file valgrind leak log
the relevant part seems to be:
295862 bytes in 6038 blocks are definitely lost in loss record 231 of 231
   at 0x1B909222: malloc (vg_replace_malloc.c:130)
   by 0x1B9F5CE2: JS_malloc (jsapi.c:1582)
   by 0x1BA5EBB8: js_NewScript (jsscript.c:1220)
   by 0x1BA5ED3B: js_NewScriptFromCG (jsscript.c:1251)
   by 0x1B9F959B: CompileTokenStream (jsapi.c:3340)
   by 0x1B9F9751: JS_CompileUCScriptForPrincipals (jsapi.c:3417)
   by 0x1B9F96C4: JS_CompileScriptForPrincipals (jsapi.c:3386)
   by 0x1EBF456F: AutoPushJSContext::AutoPushJSContext(nsISupports*,
JSContext*) (nsCLiveconnect.cpp:177)
forgot to mention I'm using Sun Java 1.5.0

this doesn't look like OJI... liveconnect possibly?
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: mlk
Assignee: yuanyi21 → pete.zha
Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.9a1) Gecko/20051002 SeaMonkey/1.1a
Java(TM) 2 Platform Standard Edition 5.0 Update 5

Can't access testcase from comment 0, seems attachment 12979 [details] was a typo.
Trying attachment 129796 [details] from 
Bug 215872 Browser crashes upon visiting qx.net and trying to view webmail link.

I'm starting with CPU 100%, and after some time, it goes down to reasonable
values, but then up again to 100%, and so on. Scroller scrolls, stops for a
while, scrolls, and so on.
I didn't see memory going up, so this maybe fixed by Seamonkey or JRE 1.5.0_05

So memory leak seems to be fixed, but 100% CPU with an Athlon XP1600+ / 512MB
RAM is way to much.
I'm still seeing 1MB/s growth with the testcase with linux seamonkey trunk
2005100205.
mass reassign to Alfred
Assignee: zhayupeng → alfred.peng
wfm Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.8.1a3) Gecko/20060703 SeaMonkey/1.1a
Java(TM) Platform SE 6
Java Plug-in 1.6.0 for Netscape Navigator (DLL Helper)
testcases are missing, the testcase from URL: and the attached testcase both depend on files from http://www.qx.net/ which are now missing.

I found an applet working over there: http://www.qx.net/speedtest.php

Java(TM) 2 Platform Standard Edition 5.0 Update 10
Java Plug-in 1.5.0_10 for Netscape Navigator (DLL Helper)

http://java.sun.com/javase/downloads/index.jsp
I'm not seeing a memory leak or CPU problem when I go to http://www.qx.net/speedtest.php and click the Start button, at least with Firefox 3 beta 2 on Windows XP. What exactly is the remaining problem, and what operating system(s) does it occur on?
Attachment #187372 - Attachment is obsolete: true
Attached file new testcase
I can't figure out how to get java to load the attached class and use it, but if you download this and the previous attachment and put them in the same directory the testcase will work.  Memory usage grows by 1MB/s.
Keywords: crashtestcase
The testcase is at http://a2pg.com/testcase/dvstimer.html with full Java source code. The problem is that the call to netscape.javascript.JSObject.call leaks about 140 bytes for each call. Sometimes Firefox even crashes when clicking the Back and Forward buttons to reload the page. I tested with Firefox 3 beta 2 on Windows XP. Bug 399218 and bug 165176 may be related.
Keywords: crash
Summary: memory leak on Java scroller → memory leak calling netscape.javascript.JSObject.call in Java
Flags: blocking1.9?
JST is this something we can fix in the new Java plugin for FF3?
Assignee: alfred.peng → jst
Flags: blocking1.9? → blocking1.9+
Priority: -- → P2
I'm hoping it's already been fixed. Bug 410853 explains how to install and enable the available beta.
I had to follow a slightly different set of steps to install the beta.

Instead of:

2. Open the Java Control Panel, Advanced tab, Java Plug-in node, and check the
checkbox to enable the next-generation Java Plug-In.

I had to:

2. Open the Java Control Panel, Advanced tab, Default Java for browsers node, and check the "Mozilla family" checkbox, then restart Firefox. After that, the Java console shows the Java Plug-in node and Enable the next-generation Java Plug-in is already checked.

After that, the testcase here and the one in bug 165176 seem to neither leak memory nor crash with Firefox 3 beta 2 on Windows XP. Yay!
> 
> After that, the testcase here and the one in bug 165176 seem to neither leak
> memory nor crash with Firefox 3 beta 2 on Windows XP. Yay!
> 

Awesome - given that I'm going to pull this off the blocker list..
Flags: blocking1.9+ → blocking1.9-
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → WORKSFORME
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: