none
Maximum amount of RAM that can be allocated for current process RRS feed

  • Question

  • Hi all,

    I am aware that I might be asking a question which had been asked already by many other users. But none of all the threads I viewed so far appeared to match my needs. Maybe someone can direct me to the thread which already coders my problem:

    I am writing an application which is reviewing hi-res images; the application shall run on several computers, all with Win10 but different RAM sizes installed. Timing considerations require that the application holds as many pictures in memory as possible but not more that would fit into e.g. 50% of the RAM that is free when the application started. I have tested with with all Process properties but none of them appears to show me the amount of available installed/available memory.

    The ComputerInfo class appears to be very close to what I am looking for but I have two questions:

    • TotalPhysicalMemory does only show a value which is close to the installed size on my computer:
      This property returns 0x7FDF21000 which is close to the installed 32GB but not exact. Why?
    • The TotalAvailableMemory property appears to be larger than the amount of memory I can allocate, e.g. in portions of 1MB. Does anybody have an idea why?
    • Edited by PHBecker Tuesday, October 18, 2016 10:08 AM
    Tuesday, October 18, 2016 9:44 AM

All replies

  • You are limited by the available address space for your process, which is probably about 1.7 GB for a 32-bit process, and very-very-large for a 64-bit process (certainly large enough to allocate all the RAM you can afford.)

    It's unlikely that you'll succeed allocating a single contiguous block of memory that is even close to half of that though.

    What you want to look at is the size of your "working set" for your process.

    Your operating system uses virtual memory, which means that memory is backed by the paging file on disk.  Data is swapped in and out of physical memory and stored on the hard disk in a way that is transparent to you, at the cost of performance only.

    Tuesday, October 18, 2016 6:18 PM