CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2005
    Location
    Israel
    Posts
    1,475

    OutOfMemoryException

    I am trying to define an array of 2G bytes:
    Code:
    byte[] arr = new byte[2000000000];
    But it throws an OutOfMemoryException. I can't create an array of more than 1.2GB.

    I understand that each process gets its share of the virtual memory. But I also know that the maximum virtual memory for a process is 4GB.

    How do I make it work?
    (Please don't tell me to allocate less memory )

  2. #2
    Join Date
    Feb 2005
    Posts
    24

    Re: OutOfMemoryException

    hello

    as far as I remember from my operating systems lessons, you are right , a process has 4 gb virtual memory. but that size contains the necessary parts that the operating system needs to run that process. for example as far as I remember the first 1 gb part of it is used by the operating system. i am not sure but ...
    Hasan ÇINAR

  3. #3
    Join Date
    Oct 2004
    Location
    Rocket City
    Posts
    220

    Re: OutOfMemoryException


  4. #4
    Join Date
    Sep 2005
    Posts
    9

    Re: OutOfMemoryException

    there is an implementation here for a big array
    http://blogs.msdn.com/joshwil/archiv...10/450202.aspx

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured