I strongly expect this to end up as a duplication, but I can't seem to find it.
I've got a C++ program that I normally run on 64-bit MacOSX SnowLeopard.
When I try to run it on a 32-bit Windows 7, it runs out of memory. Probably, it really needs too much memory, but I want to make sure that I'm not missing some sort of option or another that allows me to squeeze out the maximum possible heap size.
32 bit Process have a 4GB memory limit, but it's spitted into 2GB for the user address space and the kernel address space.
There is a /3GB switch so that you can use 3GB for the user space and 1 GB for the kernel space. To do this you need to change a setting in the OS through boot.ini(Win 2000, XP, 2003) or the bcdedit utility(Win Vista an later). Also you need to make your exe aware of this switch linking it with the /LARGEADDRESSAWARE flag. You can do this with the editbin utility(it comes with the Windows SDK).
Other than that I'm afraid you have to make some changes to how your app runs so that it doesn't take as much memory.
According to this table, the limit per process should be 2GB or 3GB with some registry tampering. I don't think this is much different from previous versions of Windows. I recall XP limited addressable memory to 3GB.
Related
Both MS Windows and Oracle Linux allows 32bit applications to use >4GB of Memory. Windows method is AWE: Address Windowing Extensions and Linux's method is Very Large Memory.
How it works: 32-bit application can't directly address > 4 GB of Virtual memory; but 64-bit OS can and 4GB of memory is too small to some applications. So, VLM and AWE allow application to reserve huge amount of memory from 64bit OS (or even from 32bit OS with AWE). 32-bit application can't address this memory directly, but it can ask OS to setup mapping of some part of huge memory into first 4GB (into 32-bit virtual space), then this memory can be accessed, modified; then it is unmapped back (with OS request).
Question is: Is there something like VLM or AWE in Solaris OS (version 10 or 11; x86_64 or sparc64)?
There is no library I'm aware of but implementing it would be quite straightforward under Solaris (and all Unix/Unix like OSes supporting tmpfs and mmap).
Just create a file the size you want (eg: 16 GiB) in /tmp (assuming /tmp is on tmpfs, the default configuration) and have the process(es) mapping various areas of this file to access memory at the wanted offsets.
Should you really want to access physical memory and not virtual one, you can use Solaris ramdisk support (ramdiskadm) instead of tmpfs.
Solaris supports PAE (Physical Address Extension), but Googling around doesn't paint a pretty picture. There is very little information available, and most of it is dire warnings that a bunch of third-party drivers won't work with it.
Is a 32-bit program running on a 64-bit OS able to use more than 4GB of memory if available?
Short answer is: yes.
Longer answer is depends. There is a hardware support for page re-mapping, which basically gives your program a window of a few pages into a larger area of memory.
This window is however, should be managed by the program itself and will not get support from memory manager. There are examples of programs doing that like SQL on Windows.
However, in general it is a bad idea and the program should either limit itself for 4GB or move to 64bits :)
Normally you're limited to a 2GB address space, in which all your allocations and their overhead, fragmentation, etc., must fit along with memory-mapped files (which includes your program and the DLLs it uses). This effectively limits you to 1.5GB.
With special configuration, e.g. /3GB, you can make more than 2GB available to applications, but by doing so you rob the kernel of space, costing you file caching, handle capacity, etc..
On Win32, you can use more with PAE support, but it's not transparent, you have to manage it yourself.
Only by explicitly mapping 4GB ranges of memory into its address space.
Can a 64bit Citrix server running a 32bit app through WoW64 handle just as many instances/users as the 32bit Citrix server equivalent?
And if so if I up the memory in the 64bit server will the number of instances/users scale too?
Or are there some strange memory considerations with a 64bit server running a 32bit app?
Just as an example - We're currently piloting running a 32-bit app on 64-bit.
Increasing memory on the server to around 12G (from 4), allows us to run around 130 instances of the app comfortably. On 32-bit, it's more like forty instances.
Of course, Your mileage may vary.
There may be other concerns to interest you though, especially printer drivers, depending on what solution you use there.
The constraints for a 32 bit Citrix (or Terminal) server are usually in the kernel resources: paged pool, non paged pool, session view space and system page table. On 64 bit OS this is no longer a limit so yes you could run more instances/users. At some point other resources like cpu and disk i/o will become a bottleneck of course.
Under Windows Server 2003, Enterprise Edition, SP2 (/3GB switch not enabled)
As I understand it, and I may be wrong, the maximum addressable memory for a process is 4GB.
Is that 2GB of private bytes and 2GB of virtual bytes?
Do you get "out of memory" errors when the private byte limit or virtual byte limit is reached?
It is correct that the maximum address space of a process is 4GB, in a sense. Half of the address space is, for each process, taken up by the operating system. This can be changed with the 3GB switch but it might cause system instability. So, we are left with 2GB of addressable memory for the process to use on its own. Well, not entirely. It turns out that a part of this space is taken up by other stuff such as DLLs an other common code. The actual memory available to you as a programmer is around 1.5GB - 1.7GB.
I'm not sure about how you can handle accidentally going above this limit but I know of games which crash in large multiplayer maps for this reason. Another thing to note is that a 32bit program cannot use more than the 2GB address space on a 64bit system unless they enable the /LARGEADDRESSAWARE:YES linker flag.
Mark Russinovich started a series of posts on this..
Pushing the Limits of Windows: Physical Memory
While 4GB is the licensed limit for 32-bit client SKUs, the effective limit is actually lower and dependent on the system's chipset and connected devices. The reason is that the physical address map includes not only RAM, but device memory as well, and x86 and x64 systems map all device memory below the 4GB address boundary to remain compatible with 32-bit operating systems that don't know how to handle addresses larger than 4GB. If a system has 4GB RAM and devices, like video, audio and network adapters, that implement windows into their device memory that sum to 500MB, 500MB of the 4GB of RAM will reside above the 4GB address boundary.
You can only access 2Gb of memory in total (without the 3Gb switch) on 32bit Windows platforms.
You could run multiple 32bit VMs on a 64bit OS so that each app has access to as much memory as possible if your machine has more than 4Gb.
A lot of people are just starting to hit these barriers, I guess it's easier if your app is in .net or Java as the VMs happily go up to 32Gb of memory on 64bit os.
On 32 bits, if there is enough physical memory and disk space for virtual memory, memory runs out around 3GB since the kernel reserves the address space above 0xC0000000 for itself. On a 64 bits kernel running a 64 bits application, the limit is at 8TB.
For more details, check out MSDN - Memory Limits for Windows Releases
Maximum addressable memory for a 32bit machine is 4GB, for a 64bit machine you can address loads more. (Although some 32bit machines have extension systems for accessing more, but I don't think this is worth bothering with or considering for use).
You get out of memory errors when the virtual limit is reached. On Windows Server 2003, task manager tells you the limit on the performance tab labelled 'Commit Charge Limit'.
Jeff covered this a while back on his blog in terms of 32 bit Vista.
Does the same 32 bit 4 GB memory cap that applies in 32 bit Vista apply to 32 bit Ubuntu? Are there any 32 bit operating systems that have creatively solved this problem?
Ubuntu server has PAE enabled in the kernel, the desktop version does not have this feature enabled by default.
This explains, by the way, why Ubuntu server does not work in some hardware emulators whereas the desktop edition does
Well, with windows, there's something called PAE, which means you can access up to 64 GB of memory on a windows machine. The downside is that most apps don't support actually using more than 4 GB of RAM. Only a small number of apps, like SQL Server are programmed to actually take advantage of all the extra memory.
Yes, 32 bit ubuntu has the same memory limitations.
There are exceptions to the 4GB limitation, but they are application specific... As in, Microsoft Sql Server can use 16 gigabytes with "Physical address Extensions" [PAE] configured and supported and... ugh
http://forums.microsoft.com/TechNet/ShowPost.aspx?PostID=3703755&SiteID=17
Also drivers in ubuntu and windows both reduce the amount of memory available from the 4GB address space by mapping memory from that 4GB to devices. Graphics cards are particularly bad at this, your 256MB graphics card is using up at least 256MB of your address space...
If you can [your drivers support it, and cpu is new enough] install a 64 bit os. Your 32 bit applications and games will run fine.
There seems to be some confusion around PAE. PAE is "Page Address Extension", and is by no means a Windows feature. It is a hack Intel put in their Pentium II (and newer) chips to allow machines to access 64GB of memory. On Windows, applications need to support PAE explicitely, but in the open source world, packages can be compiled and optimized to your liking. The packages that could use more than 4GB of memory on Ubuntu (and other Linux distro's) are compiled with PAE support. This includes all server-specific software.
In theory, all 32-bit OSes have that problem. You have 32 bits to do addressing.
2^32 bits / 2^10 (bits per kb) / 2^10 (kb per mb) / 2^10 (mb per gb) = 2^2 = 4gb.
Although there are some ways around it. (Look up the jump from 16-bit computing to 32-bit computing. They hit the same problem.)
Linux supports a technology called PAE that lets you use more than 4GB of memory, however I don't know whether Ubuntu has it on by default. You may need to compile a new kernel.
Edit: Some threads on the Ubuntu forums suggest that the server kernel has PAE on by default, you could try installing that.