you could catch the exception:
try {
... execute javascript ...
} catch (OutOfMemoryError ex) {
... do what you want to do ...
}
Marcello
On Wed, Feb 4, 2009 at 11:59 AM, Rhino user <[email protected]> wrote:
> My script looks like this -
> var i = "0";
>
> init("A qucik brown fox jumps over the lazy dog A qucik brown fox
> jumps over the lazy dog A qucik brown fox jumps over the lazy dog A
> qucik brown fox jumps over the lazy dog A qucik brown fox jumps over
> the lazy dog A qucik brown fox jumps over the lazy dog A qucik brown
> fox jumps over the lazy dog A qucik brown fox jumps over the lazy dog
> A qucik brown fox jumps over the lazy dog A qucik brown fox jumps over
> the lazy dog A qucik brown fox jumps over the lazy dog A qucik brown
> fox jumps over the lazy dog A qucik brown fox jumps over the lazy dog
> A qucik brown fox jumps over the lazy dog A qucik brown fox jumps over
> the lazy dog A qucik brown fox jumps over the lazy dog A qucik brown
> A qucik brown fox jumps over the lazy dog A qucik brown fox jumps over
> the lazy dog A qucik brown fox jumps over the lazy dog A qucik brown
> fox jumps over the lazy dog A qucik brown fox jumps over the lazy dog
> A qucik brown fox jumps over the lazy dog A qucik brown fox jumps over
> the lazy dog A qucik brown fox jumps over the lazy dog A qucik brown
> fox jumps over the lazy dog A qucik brown fox jumps over the lazy dog
> A qucik brown fox jumps over the lazy dog A qucik brown fox jumps over
> the lazy dog A qucik brown fox jumps over the lazy dog ");
>
> function init(s)
> {
> while(i=="0")
> s+=s;
> }
>
> I get
> ava.lang.OutOfMemoryError: Java heap space
> at java.lang.String.concat(String.java:1831)
> at org.mozilla.javascript.ScriptRuntime.add(ScriptRuntime.java:2296)
> at org.mozilla.javascript.gen.c3._c1(externalScript:11)
> at org.mozilla.javascript.gen.c3.call(externalScript)
>
> How can I avoid it?
> Thanks
> -Anupama
> _______________________________________________
> dev-tech-js-engine-rhino mailing list
> [email protected]
> https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino
>
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino