max length of eval expression


S

sudhaoncyberworld

using eval function i am executing a lengthy string expression...in
fact i am framing some string which contains the commands of creating
elements using dom2...this is very very lengthy string

Is there any limitation for that

eval(exp);
here what is max length(limitation) of exp ?

thanks
Sudhakar
 
Ad

Advertisements

S

sudhaoncyberworld

this is we are executing on client side....so we can't fix it....a
typical expression length was about 35000 chars...it may go more than
this
 
Ad

Advertisements

V

VK

this is we are executing on client side....so we can't fix it....a
typical expression length was about 35000 chars...it may go more than
this

Sorry, you did not understand, that was the answer, not a question :)

- What is the maxlength of exp in eval(exp) ?
- The maxlength is the available computer memory.

More precisely it's limited by the allowed string buffer (because exp
is passed as string). JavaScript is memory management free language so
theoretically any variable can take all available memory resource if
needed. From the other side String is using (the same as array)
indexing mechanics for its methods (like charAt) So I would expect some
problems to start after String.length will pass the magic level
4,294,967,295
But from the other side client browse will most probably send your
script to hell with such demands - and much earlier than that. :)
35000 chars - I never tried but officially nothing illegal.
 

Top