Closed Bug 482018 Opened 17 years ago Closed 13 years ago

JSOP_POP does not set JSRuntime.gcPoke

Categories

(Core :: JavaScript Engine, defect)

x86
All
defect
Not set
major

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: igor, Unassigned)

References

()

Details

Currently JSOP_POP in the interpreter does not set JSRuntime.gcPoke which prevents scheduling a GC when the allocator hits the malloc limit heuristics. This can trivially lead to OOM errors when allmost all the allocated memory is a garbage like thbe following example for js shell demonstrates: @watson~> cat ~/s/x1.js function f() { var s = Array(5<<20).join("."); for (var i = 0; i != 500; ++i) { s.substring(1); } } f(); print('OK'); @watson~> ~/build/js32.tm.dbg/js ~/s/x1.js /home/igor/s/x1.js:5: out of memory If in the example the line s.substring(1); would be changes into var tmp = s.substring(1); the shell would successfully run the example.
Could we not eliminate gcPoke and, if the GC can end up running fruitlessly (called too often with a totally-live heap and no garbage to collect) deal with that problem some other way? My recollection of gcPoke goes back 13 years. It was a quick and dirty idea for avoiding excessive, fruitless GC runs, but there must be a better way. /be
This completes w/o OOM.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.