views:

298

answers:

7

It is well known that on XP Pro the whole OS can only use 3GB. On 32 Bit Windows Server 2003 the limits are higher. How much can visual studio address and use if the OS isn't imposing artificial constraints?

Background. I have 4GB, use Resharper, get lots of out of memory errors and I'm wondering if throwing more hardware at the problem would help.

+1  A: 

Here is a link to the memory limits to windows

http://msdn.microsoft.com/en-us/library/aa366778(VS.85).aspx

Kevin
+2  A: 

2 Gigabytes on x86

The Matt
This seems to be the case as it does not look like the visual studio exe is marked as being large address space aware.
Jim Petkus
Right. Windows has a limit that's different than Visual Studio. You'll hit the VS limit before you hit the Windows.
The Matt
A: 

4GB - 256 GB depending on the version of Windows Server 2003 you have.

Here is the link: http://msdn.microsoft.com/en-us/library/aa366778(VS.85).aspx

waqasahmed
Those would be figures for the amount of memory the Operating system can address, not a process (e.g. Visual Studio). Also according to your link the upperbound limits for W2k3 are 2GB-128GB depending on the version.
CptSkippy
A: 

The restraints per process should remain unchanged for any 32-bit OS. The default is 4GB of address space per process, with 2GB of that reserved for the OS itself. There is a flag for Windows which you can use to change it to 1GB of reserved memory and 3GB of userspace memory.

Jimmy
The default is 2GB of address space, not 4.
CptSkippy
No, it's 4GB per process with 2GB reserved for the OS = 2GB usable by the process.
Andrew Medico
+2  A: 

2 Gigabytes on x86 by default

Steven Harman put out a very useful blog post about extending the memory available to Visual Studio to 3 Gigabytes.

The problem is with Visual Studio. Being a 32-bit application its limited to just 2GB of virtual memory, even if its running in a 64-bit OS. At least, its limited to 2GB by default... but we can change that.

So the trick to extending it is increasing the amount of user-mode memory, and then making Visual Studio Large address aware.

I have successfully done this to 3GB. I do not know if there is an upper bound before hitting the OS limit.

Matthew Vines
devenv.exe IS largeaddressaware out of the box, you can check with dumpbin /headers. Besides, modifying the bit on an image is suicidal. If the process is not prepared to handle addresses above the 0x7FFFFFFF range it can crash when it sees one. This is because addresses in the 2GB-3GB range have the sign bit on and many applications will treat it as a negative.
Remus Rusanu
I don't think that is correct. Resharper's JetBrains proposes a similar fix, and then links to Mr. Harmans post. http://www.jetbrains.net/confluence/display/ReSharper/OutOfMemoryException+Fix
Matthew Vines
What is incorrect? The ouput of dumpbin /headers ? I doubt.
Remus Rusanu
It is my understanding that it only registers as LargeAddressAware on 64 bit OS. If your box is running 64 bit that would make sense. His question is about 32 bit OS. See http://serverfault.com/questions/27352/are-there-any-drawbacks-of-3gb-switch-in-boot-ini-for-32bit-windows/27355 and his cooresponding link to msdn.
Matthew Vines
VS 2k5 was not aware. VS 2k8 is. Steven Harman's article was probably written on 2k5 days. The OP is tagged 2k8. I'm not aware of *any* product shipped by MS that changes the alregaddressaware bit on installation based on host OS.
Remus Rusanu
I will admit that I do not completely Grok this issue, and I do believe what you have said. But I can verify that having had issues with Out of Memory exceptions during builds in VS2008 prior to implementing the steps described in the article. I no longer have the issue now that it has been implemented.
Matthew Vines
because you added /3gb. that should had been enough. Although I admit splitting hairs like this is kinda ridiculous :). But I stand by my warning: making processes that are unaware of large addresses suddenly see large addresses is potentially catastrophic. That one I DO know it first hand.
Remus Rusanu
It's appreciated, you made me do a lot of research on the topic I wouldn't have done otherwise, I learned a lot along the way.
Matthew Vines
A: 

There are no artificial constraints on memory, if you are using a 32Bit OS then you are limited to 3GB of addressable memory space. If you use 64Bit then addressable memory space is much bigger.

The only way to get more memory for Visual Studio would be to enable AWE (if Visual Studio is AWE aware) or using the /3GB switch when booting windows.

Use a 64Bit processor (e.g. Core2) with a 64Bit OS to get the best performance as you can then access as much memory as you can stuff into your development box. ;)

Frozenskys
A: 

devenv.exe is large address aware, so it can use 3GB if the system is booted with /3gb in the boot.ini. XP supports the /3gb flag.

Don't know where you gets your facts for 'well known' stories, but the XP 3GB OS limit, not true.

BTW, even if devenv.exe is large address aware, that does not guarantee that add ons will use the space above 0x7FFFFFFF so Resharper may still hit out of memory exceptions.

Remus Rusanu