In comp.lang.javascript message <49778665-56b9-4190-8e29-ee0624086ed0@h2
3g2000vbc.googlegroups.com>, Sat, 30 May 2009 08:30:56, raphpell
I reached Javascript memory limit in all browser ( IE, Firefox,
Chrome, Opera, ...). Is there an issue ?
It would he helpful if you were to post in French, in which you would
clearly be able to express yourself more elegantly and in more detail.
You can put an "English" version for those of the less well educated who
have not yet discovered Google Translate; and you can ignore complaints
from the uncouth.
ISTM that there are two (or more) limits to consider.
In a given implementation of JavaScript, there will be limits on the
number and size of objects due to internal addressing using numbers of
limited length (that's not a requirement, but it is to be expected;
those numbers could well be 16- or 32-bit).
And in a given host system, there will be a limit on the amount of
actual RAM which your JavaScript can be given. If more is needed, RAM
will be swapped in and out from disc; and your code will then probably
become unacceptably slow.
I have, in estrcons.htm, a section that calculated repeats of Gregorian
Easter date sequences - for example, 1948-2047 repeats 2100-2199,
1498-3600 repeats 427098-429200. Ideally, I'd check over, say,
5,720,000 years. For efficiency, one needs an array of the date (of
March) of Easter for all years covered, and a quantity of other arrays
to keep track of what has been found. The present code works well for
600,000 years; but above that, thrashing sets in.
In the first case, the JavaScript system should give a definite error
message and quit. It cannot be reasonably expected, in the second case,
to recognise when to give up.
It's a good idea to read the newsgroup c.l.j and its FAQ. See below.