| | |
Maximum Array
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Apr 2006
Posts: 88
Reputation:
Solved Threads: 2
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.
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.
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.
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
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
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
Loren Soth
Crimson K. Software _________________________________________________________________ Crimson K. Blog
![]() |
Similar Threads
- How to find the maximum value in each column of 2D? (C++)
- hw to find large value in a array without using IF STATEMENT (C)
- beginner"problem in arrays help me in codes" (C)
Other Threads in the C# Forum
- Previous Thread: encapsulating an array in a class?
- Next Thread: problem with login page
| Thread Tools | Search this Thread |
Tag cloud for C#
.net access ado.net algorithm array barchart bitmap box broadcast buttons c# chat check checkbox client color combobox control conversion csharp custom database datagrid datagridview dataset datetime degrees development draganddrop drawing encryption enum event excel file files form format forms function gdi+ httpwebrequest image index input install java label list listbox listener login mandelbrot math mouseclick mysql networking object operator path photoshop picturebox pixelinversion post prime programming radians regex remote remoting resource richtextbox save saving serialization server sleep socket sql statistics stream string table tcp text textbox thread time timer treeview update usercontrol validation view visualstudio webbrowser windows winforms wpf xml






