Closed
Bug 1030545
Opened 10 years ago
Closed 6 years ago
ConsString depth too high for Android stack
Categories
(Rhino Graveyard :: Core, defect)
Rhino Graveyard
Core
Tracking
(Not tracked)
RESOLVED
INACTIVE
People
(Reporter: epx, Unassigned)
Details
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36
Steps to reproduce:
(Version: Rhino 1.7 release 5 PRERELEASE 2012 06 29)
I am running a Javascript application within Android, using Rhino as the embedded interpreter. The app runs fine except for one operation that creates a long cookie string. The cookie is generated by concatenation of many smaller strings.
Actual results:
The operation throws a StackOverflow exception within ConsString. It seems to be caused by the recursive implementation of toString() that realizes the final, concatenated string.
Calling toString() often to force ConsString to evaluate the string before the concatenation depth gets too high, does away with the stack overflow and it is the workaround that I adopted.
Expected results:
The operation should work normally, since the cookie is just a moderately long String (6k or so). I can see that ConsString does impose itself a depth of 2000, but it is still too much when Rhino runs in Android environment (Dalvik stack is very small, it seems).
My suggestions to fix this problem are; a) implement ConsString.toString() in a non-recursive way (not sure if this is possible); or b) adopt a depth limit of 100 or 50, since optimizing out 98% or 99% of concatenations is still a nice optimization without taxing the stack too much.
Comment 1•6 years ago
|
||
Closing. Bug management is now done here:
https://github.com/mozilla/rhino
Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Resolution: --- → INACTIVE
You need to log in
before you can comment on or make changes to this bug.
Description
•