Coffeehouse Thread

8 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

?? Odd out of memory exception.

Back to Forum: Coffeehouse
  • User profile image
    magicalclick

    This is odd, I am trying to do this in WPF and C#.

    uint[] aa = new uint[500 * 1000 * 1000];

    or

    uint[] aa1 = new uint[100 * 1000 * 1000];
    uint[] aa2 = new uint[100 * 1000 * 1000];
    uint[] aa3 = new uint[100 * 1000 * 1000];
    uint[] aa4 = new uint[100 * 1000 * 1000];
    uint[] aa5 = new uint[100 * 1000 * 1000];

    And I got out of memory exception. I have 4GB free, and they only use 2GB in total.

    And what is even weirder is, I can do 300 * 1000 * 1000, which is 1.2GB "sometimes" and sometimes I get out of memory exception.

    What's is going on?

    Thank you.

    Leaving WM on 5/2018 if no apps, no dedicated billboards where I drive, no Store name.
    Last modified
  • User profile image
    AndyC

    Are you running on a 32-bit OS?

  • User profile image
    Sven Groot

    Note that as of VS2010 the default target CPU for new .Net projects is x86, which will cause it to run as a 32 bit process even on 64 bit Windows. Change the target to AnyCPU and it will run as a 64 bit process.

  • User profile image
    spivonious

    @magicalclick: Could it be memory fragmentation? I'm watching the Windows Memory talk that Russinovich did at PDC - really informative.

  • User profile image
    magicalclick

    @Sven Groot:

    How do I do that? For some reason I the Built tab doesn't have the target and my dropbox in toolbar is gray out. THanks.

    Leaving WM on 5/2018 if no apps, no dedicated billboards where I drive, no Store name.
    Last modified
  • User profile image
    W3bbo

    , magicalclick wrote

    @Sven Groot:

    How do I do that? For some reason I the Built tab doesn't have the target and my dropbox in toolbar is gray out. THanks.

    Certain UI components are disabled or non-visible depending on what Development mode you're in. Can you post a screenshot of your Project Properties page?

  • User profile image
    Charles

    , spivonious wrote

    @magicalclick: Could it be memory fragmentation? I'm watching the Windows Memory talk that Russinovich did at PDC - really informative.

    Agreed. All developers who target Windows (and therefore Windows memory management) should watch Mark's PDC talks on the subject of memory...: http://bit.ly/cXPJfG

    C

  • User profile image
    magicalclick

    @W3bbo:

    I think I know why. I am using Express and I checked the list

    http://msdn.microsoft.com/en-us/vstudio/aa700921.aspx

    And Express doesn't support x64. I am going to use Student Aliance Version of VS 2010 Pro. Looks like sometimes I have to use better version than Express. I am actually prefer to use Express than  Pro LOL.

    Thanks for everyone''s support, I am downloading Pro RIght now. Hope I don't have to bother you guys again. Smiley

     

    YESSSS. thanks guys.

    I can now do 500million intergers for 2GB no problem now. Weee....

    Leaving WM on 5/2018 if no apps, no dedicated billboards where I drive, no Store name.
    Last modified

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.