none
uint[300* 1000 * 1000] = out of memory exception when I have 4GB of Free RAM from 6GB total. RRS feed

  • Question

  • This is really odd, but, I get this memory out of exception at array initialization.

    uint[300* 1000 * 1000] = out of memory exception when I have 4GB of Free RAM from 6GB total.

    300million uint is only 1.2GB, so why am I gettin the error? And strangely sometimes I don't get the error. No GC related since this is what my app does at begining. I haven't done anything else yet. And I sometimes get the error or no error by re-complie and re-debug the app. And same thing happens if I make three different uint[100 * 1000000];

    What is going on? I actually want to spend 2GB of RAM, which is 500million uints. But, I couldn't even use 300million. And I have plenty of free RAM.

    Thank you.

    • Moved by Min ZhuModerator Wednesday, November 3, 2010 5:11 AM (From:Windows Presentation Foundation (WPF))
    Monday, November 1, 2010 8:55 AM

Answers

All replies

  • Go through this one ... http://social.msdn.microsoft.com/Forums/en-US/clr/thread/29fbbe6b-642a-4429-9fc9-60729e842719/

    just dont want to reiterate the same thing posted above, if you have specific questions, then feel free to holler back.


    Software Engineer 1, My Blog
    Monday, November 1, 2010 5:59 PM
  • Hi Magicalclick,

    I have moved your post from Windows Presentation Foundation(WPF) forum to Common Language Runtime forum where you could get better and quicker support.

    Thanks for your understanding!

    Best regards,

    Min


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    Wednesday, November 3, 2010 5:11 AM
    Moderator
  • Use a 64 bit OS.  32 bit limit is about 500 MB.

    • Marked as answer by SamAgain Friday, November 12, 2010 8:49 AM
    Wednesday, November 3, 2010 6:48 AM