Forum Moderators: phranque
Microsoft VBScript runtime error '800a0007'
Out of memory
/inc/xyz.asp, line 9
That particular line of code executes the following line:
Redim Cart(8,total-1) However, I cannot reproduce such error. Out of thousands of visitors per day, this only happens to a few of my visitors. I suspect there are actually more people who get this error, and only 2 reported it.
Anybody has any experience in this? Thank you in advance.
The length of every dimension of an array is limited to the maximum value of a Long data type, which is (2 ^ 64) - 1.
That's pretty big though (18446744073709551615).
Does Total-1 every get that large?
The only other possiblity is that you're literally running out of memory... could be what you are storing in the array is so large per item that you eventually get to big. Is there a way to optimize what you're doing/storing?
One thing you could do is try and trap the error when it happens and write out the array and any other pertinent information to a text file. This way when it happens you have a dump of what happened to try to debug it. You would also be able to fail gracefully and give the user a better error.
In order to do that, you'd do something like this:
On Error Resume Next
Err.Clear
Redim Cart(8,total-1)
If (Err.Number <> 0) Then
' Write Out Log Here
' Gracefully Exit
End If
-=casey=-
Have you tried mattur's suggestion of checking to see if (Total-1 > 0)?
-=casey=-
When I wrote this script, I also wrote an error detection module that traps errors. The module SHOULD reset all offending variables back to its default value when an error is detected. I just tested with a whole bunch of different values, and everything was caught by that module.