none
heap size - x64 RRS feed

  • Question

  • What is the maximum heap size when managed program is running as 64 bit process ?

    When I run a sample program that allocates in infinite loop a single megabyte one after another, on 32-bit system, the process hits Out of Memory Exception at about 1.3 GB.
    This is because user mode virtual address space for 32 bit program is 2GB, and thus the heap must be smaller than that.

    Where would my program crash if it were run on 64 bit system  ?


    User mode virtual address space is 8TB, but how much space from this the heap can take ?

    Thanks in advance,
    Michal

    Tuesday, March 22, 2011 11:25 AM

Answers

All replies

  • Hi Michael,

     

    Welcome to the MSDN forum!

     

    Have you tried to run your program on 64-bit OS?

    I don’t know how much size GC will be allotted, but I think that GC heap’s size is not a constant value.

     

    I think that how much size GC will be allotted is not an important thing. The most important thing is that how we can use GC heap in a best way. We need to improve performance both by using GC and by ourselves. GC is clever but not almighty. 95% of work has been completed by GC, we need to do the left 5% of work in order to get programs with good performance and data security.

     

    Have a nice day!


    Paul Zhou [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, March 24, 2011 3:28 PM
  • In a 64bit process, the paged pool size is limited to 128GB.  For details, see Memory limits on MSDN: http://msdn.microsoft.com/en-us/library/aa366778(v=vs.85).aspx#memory_limits

     

    However, there is still a 2GB limit for a single allocation in the GC - which means no "huge" arrays of structs (as they count as one memory allocation).

     


    Reed Copsey, Jr. - http://reedcopsey.com
    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
    Thursday, March 24, 2011 6:56 PM
    Moderator