Maximum Array

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Apr 2006
Posts: 88
Reputation: blacklocist is an unknown quantity at this point 
Solved Threads: 2
blacklocist blacklocist is offline Offline
Junior Poster in Training

Maximum Array

 
0
  #1
Apr 20th, 2006
Quick question, I know this is actually sorta a stupid question but what is the maximum number of elements in a array?

Not one time has anyone told me a real answer. They all seem to sorta let that question slide by. Also have tired a google search and found nothing related to that.

No it may not simply be a simple number, could is be constrainted to RAM? Just wondering if anyone knows.
Reply With Quote Quick reply to this message  
Join Date: Dec 2003
Posts: 2,414
Reputation: alc6379 has a spectacular aura about alc6379 has a spectacular aura about alc6379 has a spectacular aura about 
Solved Threads: 123
Team Colleague
alc6379's Avatar
alc6379 alc6379 is offline Offline
Cookie... That's it

Re: Maximum Array

 
0
  #2
Apr 20th, 2006
I couldn't really find anything on it, either. I'm guessing that it really depends on the system. You could probably create as many elements as you could the largest integer on a system would be, considering how that could differ for different platforms, ie, 64 Bit vs 32 bit.

But before that, you'd probably reach the upper limit of memory. Keep in mind that every time you place an object in an array, it allocates a certain amount of memory to that object. So, if an object of type int is 32 bits long, that's how much memory that would be allocated for each element in the array. So, if an array consisted of 500 int objects, then it would be right at around 2KB in size.
Alex Cavnar, aka alc6379
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 233
Reputation: Lord Soth is an unknown quantity at this point 
Solved Threads: 4
Lord Soth's Avatar
Lord Soth Lord Soth is offline Offline
Posting Whiz in Training

Re: Maximum Array

 
0
  #3
Apr 20th, 2006
Hi,

It is limited with your Virtual Memory Size (if you set to automatic management then it is limited to your free disk space on the drive where your page file resides) I successfully created an array of 100,000,000 int's and the Task manager showed me ~400MB of Virtual Mem usage (I have 512 RAM+512 non-resizable page file) when I created 250,000,000 I got an OS warning saying Virtual Memory too low and for 1,000,000,000 elements the code just gave an Out of Memory error and breaked to IDE.

Loren Soth
Best regards,
Loren Soth

Crimson K. Software _________________________________________________________________ Crimson K. Blog
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 88
Reputation: blacklocist is an unknown quantity at this point 
Solved Threads: 2
blacklocist blacklocist is offline Offline
Junior Poster in Training

Re: Maximum Array

 
0
  #4
Apr 21st, 2006
Wow, one billion element array. Well thanks for both of your replies!
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for C#
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC