I am puzzled and looking for a workaround if possible, and some how too info.
I have an array, 4 dimensions
Per MS documentation at <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcn7/html/vacondeclaringarrays.asp
g Array Variables</a>
No one of my dimensions is greater than 2^64 -1
actually not even close, maximum dimensions size is 256
So I could have Dim MyArray(256,256,256,256) As Integer
as the largest array [actually, do a ReDim based upon input from user, but above is maximum size]
When I have such an array, I get System.OutofMemoryExceptio
By trial and error, so far largest array that does not throw the error is 100,100,100,100
[actually I am somewhere between 100 & <130, on my machine]
But MS documentation, same link also says:
"The total size limit of an array varies, based on your operating system and how much memory is available. Using an array that exceeds the amount of RAM available on your system is slower because the data must be read from and written to disk."
OK, so I have an array larger than RAM can handle . . . I'll take the hit to speed, it can read/write to disk, but it is obviously not doing so.
The way I read MS doc is that with my large array it should be reading/writing to disk, yes it slows down program, but that is better than it throwing OutofMemoryException.
1. Is MS doc wrong, or is there some parameter, class, setting I need to specify to tell it to read/write large arrays? e.g. somewhere in program a line that reads in essence "OK stupid, if an array is too big for memory, read/write it to disk, like MS doc says you should"
2. Ignoring idiocy of doc for a second, is there some other way I can store the data that gets stored in the array and achieve the functionality [I know of a couple of ways myself, but they would involve major rewrite of code - read/write to a file, bust array up into parts - that is there some other object/class that could do it?]
3. I suspect MS doc is wrong. In which case how do I tell before program gets to the error, how big of an array the memory for a given machine can handle?
That is, when user specifies array size, have program do a calculation so as determine at user input time, that the array is either too big for that user's machine, or machine does have enough RAM?
And if not enough RAM for say 256^4, how big the array could be and still run?
Rather than user enters size, runs it, gets error, tries again w different value, gets error, tries again...?