How to get address space size that a process is allowed to use

Hi All,

From C++, I just want to find the address space size that a process is allowed to use. For ex, in 32 bit OS the allowed address space is 4GB and in 64 bit OS I guess this is 16GB or more.

I jsut want to find it in my C++ project. Is there any API calls that gives me such information.

Thanks,
Sendil

man getrlimit

To expand on achenle's suggestion, 4GB in a 32-bit system is the physical limit. There are 4GB possible different addresses a process can possibly have in its' address space in a 32-bit address space. Doesn't mean the OS will actually let it have that much.