How much RAM can an application allocate on 64-bit x86 Linux systems

hardwarekernelpaeramvirtual-memory

Is it true that a single application can not allocate more than 2 GiBs even if the system has GiBs more free memory when using a 32-bit x86 PAE Linux kernel? Is this limit loosened by 64-bit x86 Linux kernels?

Best Answer

A 32-bit process has a 32-bit address space, by definition: “32-bit” means that memory addresses in the process are 32 bits wide, and if you have 232 distinct addresses you can address at most 232 bytes (4GB). A 32-bit Linux kernel can only execute 32-bit processes. Depending on the kernel compilation options, each process can only allocate 1GB, 2GB or 3GB of memory (the rest is reserved for the kernel when it's processing system calls). This is an amount of virtual memory, unrelated to any breakdown between RAM, swap, and mmapped files.

A 64-bit kernel can run 64-bit processes as well as 32-bit processes. A 64-bit process can address up to 264 bytes (16EB) in principle. On the x86_64 architecture, partly due to the design of x86_64 MMUs, there is currently a limitation to 128TB of address space per process.

Related Question