Memory allocation is set automatically.
If a 32-bit application is compiled with the IMAGE_FILE_LARGE_ADDRESS_AWARE switch set it is allocated a 4GB address space in 64-bit Windows. If not, it is allocated 2GB.
For 64-bit applications, if IMAGE_FILE_LARGE_ADDRESS_AWARE is set when compiled - the default is set - it can use up to 8TB. If IMAGE_FILE_LARGE_ADDRESS_AWARE is cleared it can use up to 2GB.