473,543 Members | 2,030 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

max length of eval expression

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(limitati on) of exp ?

thanks
Sudhakar

Jan 12 '06 #1
4 4327
VK

su************* **@gmail.com wrote:
eval(exp);
here what is max length(limitati on) of exp ?


the available computer memory

Jan 12 '06 #2
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

Jan 12 '06 #3
VK

su************* **@gmail.com wrote:
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.

Jan 12 '06 #4
On 2006-01-12, VK <sc**********@y ahoo.com> wrote:

su************* **@gmail.com wrote:
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.


yes, I think so, I've used upto 60000 bytes...
More precisely it's limited by the allowed string buffer (because exp
is passed as string).
yes.
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.

2 megs less 1 works here. is that likely to be enough?
(I have not tested longer)

try this: (it makes a really long "1+1+1+1+1+1+1+ 1" by doubling )

var s='1',x;
for(x=20;x;--x)s=s+'+'+s;
alert("length=" +s.length+"\nva lue="+ eval(s));

Bye.
Jasen
Jan 13 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2682
by: Jeremy Sanders | last post by:
Hi - I'm trying to subclass a dict which is used as the globals environment of an eval expression. For instance: class Foo(dict): def __init__(self): self.update(globals()) self = 42
1
3226
by: Penguin | last post by:
For some odd reason, I am trying to do some complex time calculations that I want to let the user define. So I set up a table with EventID EventType EventExpression 1 SolarNoon datediff("n",Sunrise,Sunset) etc. This is supposed to be evaluated with TimeofNoon=Eval(EventExpression)
4
6245
by: David Bartosik - MS MVP | last post by:
If I have... <TD><%# DataBinder.Eval(Container.DataItem, "Print_name") %></TD> and I want to display only the first 12 characters of the "Print_name" data field, how is that done? --
1
1704
by: Benton | last post by:
Hi there, I have a HyperLink control inside a DataList's ItemTemplate: <asp:DataList ID="lstDatos" runat="server"> <ItemTemplate> <asp:HyperLink ID="lnkName" runat="server" CssClass="Link" Text='<% #Eval("NAME") %>' NavigateUrl="repInTransitByProvider.aspx?id=<% #Eval('ID') %>"> </asp:HyperLink>
3
3628
by: ray_usenet | last post by:
Why is this: eval('') is OK, but eval('{"active":"true"}') tells me I'm missing ";" ? Then why is it that if I put parentheses around the second statement:
8
2165
by: abhishek | last post by:
>>a,b=3,4 7 Now I want to evaluate y by substituting for the evaluated value of x. eval(y) will try to add "a+b" to 3 and return an error. I could do this, 10 but this becomes unwieldy if I have and so on, because the replacements have to be done in exactly the
8
9242
by: fredo | last post by:
This question was asked in comp.lang.javascript with no result. In IE5.x and IE6, I want to display an image when the user rolls over a text link. The image does indeed display, but only on the first rollover. It seems that the image height and width become set to zero after the image is displayed once; or perhaps that the...
8
2195
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - When should I use eval? ----------------------------------------------------------------------- The ` eval() ` function should _only_ be used when it is necessary to evaluate a string supplied or composed at run-time; the string can be anything from a simple...
8
8699
by: sneddo | last post by:
Ok I am trying to do the above, I have got a script that will restrict the length but it requires the user to enter the field and hit a key, before it will work. This would normaly be find, but the title field gets its information from a previouse page so its value can easily be over 40 chars. (I can not restrict the length on the previouse...
0
7412
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7355
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7594
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7746
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
4899
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3394
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3394
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1830
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
979
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.