0

Possible Duplicate:
What is the maximum length of an array in .NET on 64-bit Windows

What is the exact maximum theoretical size of an array on a x86 platform in .NET? Is is given by Int32.MaxValue or UInt32.MaxValue?

Community
  • 1
  • 1
Miguel
  • 3,466
  • 8
  • 38
  • 67
  • I would say an indirect duplicate at best, the question itself certainly gives you the impression they are not duplicated, but the eventual answer seems the same. – Adam Houldsworth Mar 18 '11 at 11:05
  • Again that is a theoretical limit, as the address space itself is bounded by 2GB limit on 32 bit Windows, therefore no program would be allowed to reach that limint in CLR. – Sanjeevakumar Hiremath Mar 18 '11 at 11:11

2 Answers2

3

In theory it's 2,147,483,647 item (ie 2GB) at it uses an int. However, given that an array is a contiguous block of memory of memory and a process can only have 2GB of userspace you'll never actually be able to populate an array of this size as your userspace will have code and other app data in it which will reduce space available.

Sean
  • 60,939
  • 11
  • 97
  • 136
  • On 64 bits the limit is not on the process, but on the .net (that limits the objects to 2gb) http://blogs.msdn.com/b/joshwil/archive/2005/08/10/450202.aspx – xanatos Mar 18 '11 at 11:28
0

It is determined by the value of Int32.MaxValue

Shamim Hafiz - MSFT
  • 21,454
  • 43
  • 116
  • 176