What are you trying to do with this script?

It looks like you're just making the string 's' longer and longer
forever. Eventually, the system is not going to have enough memory
available to accommodate that. That's when you'll get the
OutOfMemoryError.

On Feb 5, 6: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

Reply via email to