1

is the same as an array? i have a Jagged Arrays like the next one:

double numbers[][]=numbers[a][]

where "a" can be any number. how can i find out the maximum size for the jagged array.

i have read that it has been limited by the amount of memory or virtual memory available but how can i calculate this if mi PC has a 8 GB in RAM memory.

my main goal is to find out how much memory my program is using but i have no idea how to began to find the amount of physical or virtual memory been used

Greg
  • 23,155
  • 11
  • 57
  • 79
JUAN
  • 523
  • 4
  • 10
  • 27
  • I'd rather use performance counters: http://stackoverflow.com/questions/3411805/using-performancecounter-to-track-memory-and-cpu-usage-per-process – BlackBear Oct 03 '12 at 14:41

2 Answers2

2

It's usually the wrong question.
And it's different when you run a 32 or 64 bits system.

In a 32 bits system you have a 2GB total limit (half of the available address space), under 64 bits it is virtually unlimited.

main goal is to find out how much memory my program is using

That is different. You can start with GC.GetTotalMemory();

H H
  • 263,252
  • 30
  • 330
  • 514
  • can you tell me where do you based your answer when you sayd that a 64 bit is unlimited – JUAN Oct 03 '12 at 17:34
  • _virtually_ unlimited. 2G x 2G is probably a lot bigger than your HDD right now. – H H Oct 03 '12 at 17:40
1

The maximum size of a single array (any standard array, such as int[]) is System.Int32.MaxValue. Which means your jagged array can hold int.MaxValue of int.MaxValue items.

This link from SO has a great answer regarding the max size of arrays.

Community
  • 1
  • 1
Dave Zych
  • 21,581
  • 7
  • 51
  • 66