Limit to memory commit/reserve

Hello,

How can I get the “current” amount of memory that a particular process
can MEM_RESERVE and how can I get the amount of memory that the same
process can MEM_COMMIT? I’m aware of this paragraph from Mark
Russinovich’s Pushing the limits article :

/As you’d expect from the description of the commit guarantee, the
commit limit is the sum of physical memory and the sizes of the paging
files. In reality, not quite all of physical memory counts toward the
commit limit since the operating system reserves part of physical memory
for its own use. The amount of committed virtual memory for all the
active processes, called the //current commit charge//, cannot exceed
the system commit limit. When the commit limit is reached, virtual
allocations that commit memory fail./

But how do I get the relevant sizes in kernel mode? I’m directly using
ZwAllocateVirtualMemory syscall in case someone wondered. And to be fast
and reply to “what problem are you trying to solve” - I’m writing a
specific application for my thesis so it is not going to be a real-world
app :slight_smile:

Regards