The Visual Studio devenv.exe process is 32-bit (even when run on a 64-bit OS), so it can't use more than 4GB of virtual memory.
Unfortunately, when I am debugging my C++ application with Visual Studio I frequently run out of memory due to this 4GB limit. For example, using VMMap, below shows progression of my typical Visual Studio usage over a few hours leading to a crash.
How can I get Visual Studio to use less memory so I stop wasting time with it crashing?
Is it typical for Visual Studio to use more than 3.5 GB virtual address space?
I am using Visual Studio 2012, but I assume this problem spans different VS versions, since Visual Studio 2015 still doesn't have a 64-bit version.
(Note that VMMap reports “Free” as the remaining memory in the address space, up to 4GB for 32 bit processes, and 8TB for 64 bit processes on Windows.)
Things I've already tried:
Use a 64-bit OS If you upgrade your system from a 32-bit version of Windows to a 64-bit version, you expand the amount of virtual memory available to Visual Studio from 2 GB to 4 GB. This enables Visual Studio to handle significantly larger workloads, even though it is 32-bit process.
If your specific process attempts to exceed the size of process virtual address space, it will simply run out of memory. What will happen is exactly what normally happens when your process runs out of memory - memory allocation function will return null pointer or something like that.
Virtual memory is a memory management technique developed for multitasking kernels. Virtual address space is a memory mapping mechanism available in modern operating systems. So the answer is: yes, these are quite different terms.
In 64-bit Windows, the theoretical amount of virtual address space is 2^64 bytes (16 exabytes), but only a small portion of the 16-exabyte range is actually used.
It is possible to reliably get Visual Studio to stay within it's 4GB of virtual memory, but you might have to experiment with one or more of the following strategies while measuring devenv.exe memory usage with VMMap:
I have observed disabling most symbol loading reducing devenv memory usage by 1.7 GB and deleting my .suo and .sdf file reducing memory usage by an additional 600 MB. This reduction in memory usage made Visual Studio go from crashing multiple times a day to running stable with the same instance running for multiple days, sometimes weeks.
In addition to reducing memory usage, these strategies will likely significantly speed up Visual Studio.
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