473,654 Members | 3,042 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 4343
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
2688
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
3234
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
6247
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
1707
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
3631
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
2169
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
9258
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 height:expression(eval(...)); code is executed only once for each page load/reload. problem demo:
8
2202
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 (but unpredictable) expression such as 12*2.54 to a substantial piece of javascript code. The `...
8
8707
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 page.) The major dificulty is that there is no form on the aspx page, and I do not have access to...
0
8375
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
8482
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8593
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6161
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5622
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4149
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4294
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2714
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
1916
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.