The theoretical memory limit that a 64-bit computer can address is about 16 exabytes (16 billion gigabytes), Windows XP x64 is currently limited to 128 GB of physical memory and 8 TB of virtual memory. In the future this limit will be increased, basically because hardware capabilities will improve.
Remember that 64-bit Windows 10 Pro, Enterprise, and Education will support up to 2TB of RAM, while the 64-bit version of Windows 10 Home is limited to only 128GB.
The 2 GB limit refers to a physical memory barrier for a process running on a 32-bit operating system, which can only use a maximum of 2 GB of memory. The problem mainly affects 32-bit versions of operating systems like Microsoft Windows and Linux, although some variants of the latter can overcome this barrier.
One of the simplest ways to increase the amount of memory a process can use on 32-bit Windows is to enable the /3GB flag in the Windows' boot. ini file. This has the effect of adjusting the kernel/user address space split in favour of the application by 1GB, i.e. instead of a 2GB/2GB split you have a 3GB/1GB split.
If you compile the Delphi application using the /LARGEADDRESSAWARE flag, it will be able to address the full 4GB on a 64-bit OS. Otherwise, when running in a WOW32, the OS assumes that the app is expecting the same environment that it would have on a 32-bit OS which means that of the 4GB of address space, 2GB is dedicated for the OS and 2GB is allocated to the application.
The syntax in Delphi to set the LARGEADDRESSAWARE flag in the PE executable is:
{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}
Put that in your .dpr file.
http://msdn.microsoft.com/en-us/library/aa366778(VS.85).aspx
User-mode virtual address space for each 32-bit process: 2 GB
As long as you opt into receiving 32-bit pointers with the high-bit set (by including the LARGE_ADDRESS_AWARE
PE flag), there is no 2GB limit.
var
p: Pointer;
n: Int64;
begin
p := Pointer($D0000000); //Above the 2GB line; and the 3GB line!
p := VirtualAlloc(p, 1024, MEM_COMMIT or MEM_RESERVE, PAGE_READWRITE);
if p = nil then
RaiseLastWin32Error;
n := Cardinal(p);
ShowMessage(IntToHex(n, 16));
end;
There is no 2GB limit, on 64-bit Windows, as long as you swear you can handle pointers above $7FFFFFFF.
Note: Any code is released into the public domain. No attribution required.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With