JUAN
JUAN

Reputation: 523

What is the Maximum Size that an Jagged Arrays can hold?

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

Upvotes: 1

Views: 1037

Answers (2)

Dave Zych
Dave Zych

Reputation: 21887

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.

Upvotes: 1

Henk Holterman
Henk Holterman

Reputation: 273514

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();

Upvotes: 2

Related Questions