Closed Bug 897998 Opened 11 years ago Closed 5 years ago

Out Of Memory Issue in JS 1.8.5

Categories

(Core :: JavaScript Engine, defect)

1.8 Branch
x86
Windows XP
defect
Not set
critical

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: kparpiyani, Unassigned)

References

Details

(Keywords: testcase)

Attachments

(1 file)

Attached file SampleScript.txt
User Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.72 Safari/537.36

Steps to reproduce:

We have a script which iterates for 100 millions, it fails on 9 million iterator on JS 1.8.5 engine whereas on 1.7 it works till 56 million iteration.
There is nothing inside loop other than creating simple object and pushing it to global object defined outside of loop.
JS Runtime Memory for both JS versions is set to 1 GB.
Any Idea why JS 1.8.5 takes so much memory as compared to JS 1.7?
Any resolution available to avoid so much memory consumption in 1.8.5?

Script is attached.


Actual results:

Script failed as out of memory exceptionon JS 1.8.5 on 9 million iterator


Expected results:

It should have worked at least till 56 million iteration as with JS 1.7
Severity: normal → blocker
Priority: -- → P1
(this doesn't block *mozilla* development/testing - please see https://bugzilla.mozilla.org/page.cgi?id=fields.html#bug_severity )
Severity: blocker → critical
Keywords: testcase
Priority: P1 → --
Sorry for not responding any earlier - this bug seems to have slipped through the cracks.

Mostly, that's probably because 1.8.5 is a really, really old version of SpiderMonkey, work on which has long been stopped. If it's at all possible, please update to the latest release of the shell. Currently, that's version 24, and here's documentation on how to get it:

https://developer.mozilla.org/en-US/docs/SpiderMonkey/Getting_SpiderMonkey_source_code

As for the actual issue: my guess is that the memory overhead of some structures created by your code has increased quite a bit in 1.8.5 compared to 1.7. If that's the case, updating to 24 should actually help a lot, because we made substantial improvements to memory usage, so my guess is that your script should run better than it did in 1.7. (And much faster, certainly.)
Thanks till for your reply.
We have already tried it with js24, we got the same results as with JS 1.8.5.
I have attached the script which i have used may be u can try it at your side.
For me, this loops until 66 million. On OS X, though. And it uses about 3GB of memory at that point. Memory usage keeps rising after that until it reaches about 5GB. At that point, it crashes.

For comparison, I just tried JSC and v8 (the JS engines of Safari and Chrome, respectively):

I stopped JSC at about 70 million. At that point, it used about 5GB of memory. It'd probably have crashed eventually, but things became really slow, so it might have taken a long time.

v8 used about 1.47GB for 19 million iterations. However, at that point it became so slow that reaching 20 million would probably have taken 15 minutes or so.

All in all, it looks like on Mac, we're doing pretty good here. I can't test on Windows, unfortunately.
Assignee: general → nobody
See Also: → 892451
Iain, do you think this ancient SpiderMonkey OOM issue is still valid?
Flags: needinfo?(iireland)
No, I think Till's response is sufficient. Closing as WORKSFORME.
Status: UNCONFIRMED → RESOLVED
Closed: 5 years ago
Flags: needinfo?(iireland)
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: