473,385 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Huge arrays?

VS 2003
VB.net
Win2000 SP4

The System.Array class seems to be limited to 32 bit addresses,
meaning that one can only assign 2^32 elements.

Is there any way that I can have an array that allows 2^64 elements?
Or doesn't the CLR support this on a 32 bit opsys?
I suspect that I am going to have to make such a beastie myself...

What about sparse arrays?
Nov 21 '05 #1
6 2439

Can I ask what you want to use such a beast for?

"Michael Gray" <fl****@newsguy.spam.com> wrote in message
news:d8********************************@4ax.com...
VS 2003
VB.net
Win2000 SP4

The System.Array class seems to be limited to 32 bit addresses,
meaning that one can only assign 2^32 elements.

Is there any way that I can have an array that allows 2^64 elements?
Or doesn't the CLR support this on a 32 bit opsys?
I suspect that I am going to have to make such a beastie myself...

What about sparse arrays?

Nov 21 '05 #2
Use a database to store this many elements, as collections are also limited
by an Integer. You could ofcourse use several arrays or collections.

"Michael Gray" <fl****@newsguy.spam.com> skrev i melding
news:d8********************************@4ax.com...
VS 2003
VB.net
Win2000 SP4

The System.Array class seems to be limited to 32 bit addresses,
meaning that one can only assign 2^32 elements.

Is there any way that I can have an array that allows 2^64 elements?
Or doesn't the CLR support this on a 32 bit opsys?
I suspect that I am going to have to make such a beastie myself...

What about sparse arrays?


Nov 21 '05 #3
Michael,
In addition to the other comments:

| The System.Array class seems to be limited to 32 bit addresses,
| meaning that one can only assign 2^32 elements.
..NET 1.1 has "support" for large arrays in that there is an Array.LongLength
property (Int64) & Array.GetValue & Array.SetValue are overloaded for Long
(Int64).

http://msdn.microsoft.com/library/de...engthTopic.asp

http://msdn.microsoft.com/library/de...alueTopic3.asp

| Is there any way that I can have an array that allows 2^64 elements?
| Or doesn't the CLR support this on a 32 bit opsys?
However! other then sparse arrays, which I'm not sure how much support
there is, how would you actually allocate said array? Remember that under 32
bit OS you can only index 4G of memory, of which the OS wants to keep 2G (1G
on some OSes) for itself, the runtime, your code, the stack, and other data
is going to use up part of the usable 2G, so the actually size of an Array
is going to be much smaller.

If I truly needed an "array" that is larger the 512M or so, I would consider
defining a new Type that used a file for the actual backing of the data &
read & write each element as needed. I would consider caching the elements
if performance became a problem. You could define this Type such that it
behaved like most normal collections.

Alternatively I have defined "Sparse Arrays", where I keep the "index" &
elements in a HashTable...
BTW: .NET 2.0 http://lab.msdn.microsoft.com/vs2005/ includes both a 32bit &
64bit runtime, so on a 64bit OS with the 64bit runtime you can have
obnoxiously large arrays... Whether you should or not is another discussion
;-)

Hope this helps
Jay

"Michael Gray" <fl****@newsguy.spam.com> wrote in message
news:d8********************************@4ax.com...
| VS 2003
| VB.net
| Win2000 SP4
|
| The System.Array class seems to be limited to 32 bit addresses,
| meaning that one can only assign 2^32 elements.
|
| Is there any way that I can have an array that allows 2^64 elements?
| Or doesn't the CLR support this on a 32 bit opsys?
| I suspect that I am going to have to make such a beastie myself...
|
| What about sparse arrays?
Nov 21 '05 #4
On Thu, 7 Jul 2005 11:20:04 -0500, "Jay B. Harlow [MVP - Outlook]"
<Ja************@msn.com> wrote:
Michael,
In addition to the other comments:

| The System.Array class seems to be limited to 32 bit addresses,
| meaning that one can only assign 2^32 elements.
.NET 1.1 has "support" for large arrays in that there is an Array.LongLength
property (Int64) & Array.GetValue & Array.SetValue are overloaded for Long
(Int64).

http://msdn.microsoft.com/library/de...engthTopic.asp

http://msdn.microsoft.com/library/de...alueTopic3.asp

| Is there any way that I can have an array that allows 2^64 elements?
| Or doesn't the CLR support this on a 32 bit opsys?
However! other then sparse arrays, which I'm not sure how much support
there is, how would you actually allocate said array? Remember that under 32
bit OS you can only index 4G of memory, of which the OS wants to keep 2G (1G
on some OSes) for itself, the runtime, your code, the stack, and other data
is going to use up part of the usable 2G, so the actually size of an Array
is going to be much smaller.

If I truly needed an "array" that is larger the 512M or so, I would consider
defining a new Type that used a file for the actual backing of the data &
read & write each element as needed. I would consider caching the elements
if performance became a problem. You could define this Type such that it
behaved like most normal collections.

Alternatively I have defined "Sparse Arrays", where I keep the "index" &
elements in a HashTable...
BTW: .NET 2.0 http://lab.msdn.microsoft.com/vs2005/ includes both a 32bit &
64bit runtime, so on a 64bit OS with the 64bit runtime you can have
obnoxiously large arrays... Whether you should or not is another discussion
;-)

Hope this helps
Jay


Ah, that's the answer that I was looking for...
Thanks to the other posters as well.

I knew that this rather strange request would prompt the same reaction
that I initially had: Why? and wouldn't you be better off doing it
another way?
The answers to which are: It was an enquiry to eliminate lingering
doubts, and Yes.

I really only wanted huge sparse arrays, ala FORTRAN, but noticed
these 64 bit addressing functions for System.Array objects(Getvalue &
SetValue), but was then thrown by not being able to index them as
such, except via these special functions.

They "appeared" to have 64 bit addressing, only very much "under the
hood" as it were.

It just seemed strange to me that Microsoft would go to all the
trouble of allowing 64 bit addresses in System.Array, and then going
through hoops to cover it up, by forcing the default indexing schemes
to 32 bit! (At least in VB.Net anyway)

Thanks for all your replies, problem will be solved another way...
Nov 21 '05 #5
On Thu, 7 Jul 2005 13:37:42 +0100, "Robin Tucker"
<id*************************@reallyidont.com> wrote:

Can I ask what you want to use such a beast for?

I don't really, but want huge sparse arrays, such as FORTRAN provides.
See my other reply for more info...
Nov 21 '05 #6
On Thu, 7 Jul 2005 16:30:23 +0200, "Inge Henriksen"
<in************@booleansoft.com> wrote:
Use a database to store this many elements, as collections are also limited
by an Integer. You could ofcourse use several arrays or collections.

:
Thanks for taking the time to reply.
See my lengthier response to J.B. Harlow for more details, if you are
interested.
Nov 21 '05 #7

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

Similar topics

10
by: Fabian | last post by:
Are there any speed issues in javascript with having really large arrays? I know if the array gets large enough, bandwidth and download time can be an issue, but does it take inordinate amounts of...
4
by: t | last post by:
Hello, I am going to write a program to search for prime numbers. There will be a lot of clients participating in this searching so I have to operate on very huge numbers, bigger than can be...
3
by: dpriver | last post by:
I have to initialize a huge constant array of structures(60000~100000), used as a lookup table , but it failed with System.InvalidProgramException when the items reach 18400. and if I change the...
4
by: RubenDV | last post by:
I am trying to make a cipher with a 256-bit key but i have no idea how the store this key without using arrays of ints or something like that. I just need a type that is big enough to hold the...
1
by: Reynardine | last post by:
I am calling a C/C++ DLL from C# and I am marshalling the parameters to the API call by doing a type conversion for each parameter. For example, here is my C++ API method : short int XENO_API...
6
by: ad | last post by:
I have a huge sting array, there are about 1000 element in it. How can I divide the huge array into small ones, and there are one 10 elements in a small one array?
8
by: luke.yolanda | last post by:
is anyone know how to implement a huge 2-D array? such as ' unsigned char a; ' I compile and run it in VC 6.0, but it show me an error.... thank you guys
1
by: vipinvarkey | last post by:
hello; i need to create a very long array in c of the foll specification: a however i get an error telling that the array's size is too large.the help file advices either to use malloc or...
8
by: sarega | last post by:
Hi, I have two very huge arrays, the second array contains some of the elements of array1 and also different elements, both are not of the same size, have to find only the elements that are not...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
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...

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.