How do I determine how much more memory my process can allocate
The most useful info so far seems to be use...
GlobalMemoryStatusEx() to get
MEMORYSTATUSEX.ullTotalVirtual
MEMORYSTATUSEX.ullAvailVirtual
and ...
GetProcessMemoryInfo() to get
PROCESS_MEMORY_COUNTERS.PagefileUsage
I think ullTotalVirtual is the maximum amount of memory my process can allocate. Is that right And ullAvailVirtual is the amount I have left, right But if I run my app in a loop that allocates memory, it will crash before ullAvailVirtual gets below 300MB.
Another problem is that ullAvailVirtual does not decrease steadily during this time. It seems to go down in chunks. And sometimes it even goes up.
PageFileUsage, on the otherhand, seems to correspond quite well with what I would expect. It goes up by the same amount after each allocation. But, similar to ullAvailVirtual, when my app crashes, PageFileUsage is at least 300MB less than ullTotalVirtual.
Yet another problem is that my app will crash with varying amounts of memory remaining. Sometimes its 300MB sometimes it's 600MB.
So, is there any reliable way to know how much more memory I can allocate