Visual Studio 2010 -- how to reduce its memory footprint - windows

I have a solution with just under 100 projects in it, a mix of C++ and C# (mostly C#). When working in VS2005, the working set of Visual Studio is considerably smaller than that of VS2010.
I was wondering if there are some things that can be turned off, so I can develop in VS2010 under 32-bit OS without running out of memory.

You can try using the Solution Load Manager. It'll let you mark some of the projects files as load on demand or not load at all. That may help.

A 64-bit OS should help you out a bit here, if you get more than 4GB of physical RAM. A 64-bit OS can provide 32-bit processes with a full 4 GB of virtual memory, whereas a 32-bit OS only can provide 2 or 3 gigs at best, depending on how you boot the OS.
That being said, 100 projects is a pretty fat solution file. Maybe now would be a good time to reexamine that decision...
EDIT: Running dumpbin /headers as prescribed in the article for DEVENV.EXE returns:
File Type: EXECUTABLE IMAGE
FILE HEADER VALUES
14C machine (x86)
4 number of sections
4BA1FAB3 time date stamp Thu Mar 18 06:04:35 2010
0 file pointer to symbol table
0 number of symbols
E0 size of optional header
122 characteristics
Executable
Application can handle large (>2GB) addresses
32 bit word machine
So that would indicate that an x64 box with > 4GB of RAM will probably improve your experience. You should have up to twice as much VM available for Visual Studio under a 64-bit OS...

The best thing you can do is to split up your solution. Visual Studio wasn't meant to handle so many projects in the same solution and does suffer performance problems as a result. Splitting up your solution into 5 different ones will make things better.

If you're on XP, upgrading to Vista or Windows 7 will help as it uses WPF. May reduce the memory footprint of the UI rendering which would otherwise have to use compatibility mode.

Related

Why is there no 64-bit version of VS2013?

I downloaded Visual Studio 2013 from DreamSpark but it's the 32-bit version and I couldn't find any 64-bit version. Is there none, and if so why is there no 64-bit version of Visual Studio?
Update (May 2021)
Visual Studio 2022 will ship as a 64-bit build: https://visualstudiomagazine.com/articles/2021/04/19/vs-2022.aspx
Original answer (Dec 2013)
First, there is a 64-bit C++ compiler that comes with Visual Studio tool set. So you can always change your project settings to make 64-bit builds of your app as needed.
Now, to answer the original question.
Think of it from a cost and ROI perspective. From years of shipping software at Microsoft, here's how I've seen the consideration for 64-bit builds get made.
When the 32-bit app works just fine on 64-bit, it's almost a non-starter to consider 64-bit.
Most of the projects at Microsoft aren't simple little Visual Studio projects in which the developer can just flip the Project settings from 32-bit to 64-bit. (I actually don't know if the Visual Studio team compiles Visual Studio with a VS project.) They are often well over a million lines of code that build with the VS compiler set, but from a command line and Makefile environment. Switching to 64-bit means updating a lot of this build infrastructure.
There is a cost of porting from 32-bit to 64-bit. The first cost is just fixing the bugs, getting the code to compile, restructuring the build environment, and all the upfront work just to get the initial build going.
There is an ongoing cost you pay for having separate 32-bit and 64-bit builds of an application. You have to build it twice every day. You have to run the test collateral on it twice every day. It's not a 2x cost, but it's not free either.
With more SKUs from the same code base, it increase that chances that a developer will break something when he checks in. Of course there can be automated tests to prevent this, but it will slow the developer down since he will have to go back and fix the other SKU that he doesn't have installed locally on his test machine.
Now here are some of the motivations for moving to 64-bit:
You really need to take advantage of 64-bit performance and memory architectures. Large database servers that use as much memory as possible will benefit from accessing more than 2GB limit imposed on a 32-bit Windows process.
You need to integrate with something already compiled with 64-bit. For example, if you want to write a shell extension for Windows, you will need a 64-bit build to run on 64-bit Windows. That doesn't mean the entire app has to be ported, but it does mean this component will need a separate 64-bit build.
You have a platform or API story for external developers to consider. Usually, they have their own needs for 64-bit builds. Hence, they may need a 64-bit ready API from you even if your native app can get away with 32-bit support.
Your team has just been re-organized into the Windows division and your team's code has been deemed necessary to be included into the next Windows release. There's no decision to be made anymore - your code will be compiling for 32-bit, 64-bit, and ARM (Surface RT).
Source code files should not be multiple gigabytes -- there's no reason for a text editor / development environment to use 64-bit pointers, which consume twice as much RAM for no benefit. Larger pointers make data structures containing pointers larger, requiring more memory bandwidth to move them around, and fitting fewer inside the CPU's data cache, so that the number of cache misses may increase as well.
The 32-bit editor is perfectly capable of launching and interacting with the 64-bit compilers, linkers, and debuggers when needed. Having only a 32-bit editor also simplifies the plugin model greatly.
The reason is the same as it has always been. It would require a significant effort to port a code base as large as Visual Studio to 64-bit and according to Microsoft, the benefits would be few and far in between.
In fact, MS claims that such a port could slow down Visual Studio due to the consumption of more memory. There would be poorer cache locality due to 64-bit pointers being stored in various places in the code. There is much code in VS that uses custom arena based allocators, although MS is trying to get rid of them. These could also possibly result in poorer performance, since pointer management within the arena would deal with 64-bit pointers which would occupy twice the space of their current 32-bit counterparts.
Given the tens of millions of lines of code that are Visual Studio, the effort to convert, test and tune a 64-bit version seems fraught with delays while having a seemingly small chance of having a positive outcome. If anything, MS seems more intent on porting Visual Studio to managed code in order to reap the benefits present there - a decision that is hard for us C++ developers to swallow.
For the present term, Microsoft recommends running Visual Studio in a 64-bit version of Windows, thus doubling the available address space (2 GB to 4 GB) without paying a 2x penalty for pointer storage within the VS process.

Visual Studio 2012 64 bit? [duplicate]

This question already has answers here:
Visual Studio 64 bit?
(7 answers)
Closed 8 years ago.
I know that in visual studio 2010 there wasn't 64 bit version. Is there 64 bit version for vs2012?
No, there isn't.
Probably for the same reasons stated for Visual Studio 2010 (no need for the additional address space, and because for this application it would bloat it, slow it down and will take much too long to port to such an architecture, not to mention - the 32bit version works on 64bit machines).
Update:
Microsoft have now announced that Visual Studio 2022 will be a 64-bit application.
I expect one of the main drivers is enabling the loading and debugging memory dumps that are larger than the addressable 32 bit space of ~4GB (which, given how long Windows has been 64 bits, are no longer that rare).
No there is no 64 bit version.
You can check out this link
(Thought to add the reason why it is not added)
why not 64 bit right away?
First, from a performance perspective the pointers get larger, so data
structures get larger, and the processor cache stays the same size.
That basically results in a raw speed hit (your mileage may vary). So
you start in a hole and you have to dig yourself out of that hole by
using the extra memory above 4G to your advantage. In Visual Studio
this can happen in some large solutions but I think a preferable thing
to do is to just use less memory in the first place. Many of VS’s
algorithms are amenable to this.
Secondly, from a cost perspective, probably the shortest path to
porting Visual Studio to 64 bit is to port most of it to managed code
incrementally and then port the rest. The cost of a full port of that
much native code is going to be quite high and of course all known
extensions would break and we’d basically have to create a 64 bit
ecosystem pretty much like you do for drivers.
No. There are apparently no plans also.

PC Spec for running Visual Studio 2010 + ReSharper smoothly

Assuming we have to stay on Windows XP x86, what would be the best spec for working in Visual Studio 2010 with ReSharper, PowerTool and a couple of other smaller add-ons?
Components we can upgrade are:
CPU
RAM
HDD
Graphics
At the moment, I have a Pentium Dual-Core E5300 2.6GHz with 4GB RAM and ReSharper makes Visual Studio crash in a solution of around 2000 files.
Really should be moving to Win 7, or at least Win Vista. There is MASSIVE improvements in VS just by running on top of those.
As you stated XP x86, some suggestions:
Ram: 4Gb as fast as you can get. This is important but also only depends on number of VS instances and solution size. At 4Gb I would suggest staying in the low solution bracket (< 25 projects).
CPU: Fast as you can get. Multi core helps a bit, but a lot of the VS UI is single threaded on the GUI.
HDD: VS is a harddrive monster, so fast hard drive. SSD especially here. Spend the money here FIRST. R# perf bottle neck is the file scanning so this will help with this too.
Graphics: Far more important than you would think, mostly due to the fact VS uses WPF and hardware acceleration. Very important to get a good graphics card with STABLE drivers. VS 2010 SP1 disables hardware acceleration on XP by default (can be turned on in the settings) because so many VS 2010 crashes on XP are from unstable graphic drivers and WPF hits those issues a lot. If you get a good stable one, turn that setting on!
Another issue is also just regular restarts, VS does a lot in memory and isn't too good at cleaning up. So the stack fills quickly and it will crash often (PerfWaston is looking for this info) so a restart every so often helps.
As I said at the start your best bet is also one of the cheapest (compared to new hardware) upgrade to Win7, especially x64. More RAM, better SSD support, more stable OS, there is a lot in there that will help your VS experience be faster and more stable.
I would highly recommend moving to 64-bit. Even if you just have 4GB addressable ram with Visual studio, it will have access to more memory if you get more than 4GB of RAM.
Also, get faster hard drives. SSD or RAID 5. I'd pick this over a faster CPU.

Does Visual Studio 2010 benefit from quad core vs dual core machines? Is compilation multithreaded?

I have a Windows XP machine with a dual core 3.6G CPU and 4megs. I am not very happy with the performance. I was wondering if compilation in VS 2010 is multithreaded and does VS 2010 benefit from switching from dual to quad core machine?
What language are you working in? The native C++ compiler will spawn off multiple processes when you build. In VS 2008 it was one project per core; now it will use multiple cores even if you have only one (presumably huge) project. I don't think managed code does.
A helpful blog entry on what hardware will be useful with VS 2010 is http://blogs.msdn.com/ddperf/archive/2008/12/23/visual-studio-2010-hardware-requirements.aspx for more.
You'd probably get a bigger speed up from changing your hard disk (i.e., to SSD) and installing VS and putting your projects on that disk. It'll speed up the Intellisense cache and what-not. If you're on XP rather than Vista or Windows 7 too, the shell on VS2010 was rewritten to use WPF (Windows Presentation Foundation) and WPF is not optimised for XP; it will run slower.
Compilation of large projects tends to be very disk-intensive. Getting a faster disk will speed up the build process.
Skip SSD and buy more RAM and put all your projects on RamDisk like SoftPerfect RAMDisk

Visual Studio 64 bit?

Is there any 64 bit Visual Studio at all? Why not?
For numerous reasons, No.
Why is explained in this MSDN post.
First, from a performance perspective the pointers get larger, so data
structures get larger, and the processor cache stays the same size.
That basically results in a raw speed hit (your mileage may vary). So
you start in a hole and you have to dig yourself out of that hole by
using the extra memory above 4G to your advantage. In Visual Studio
this can happen in some large solutions but I think a preferable thing
to do is to just use less memory in the first place. Many of VS’s
algorithms are amenable to this. Here’s an old article that discusses
the performance issues at some length:
https://learn.microsoft.com/archive/blogs/joshwil/should-i-choose-to-take-advantage-of-64-bit
Secondly, from a cost perspective, probably the shortest path to
porting Visual Studio to 64 bit is to port most of it to managed code
incrementally and then port the rest. The cost of a full port of that
much native code is going to be quite high and of course all known
extensions would break and we’d basically have to create a 64 bit
ecosystem pretty much like you do for drivers. Ouch.
No! There is no 64-bit version of Visual Studio.
How to know it is not 64-bit:
Once you download Visual Studio and click the install button, you will see that the initialization folder it selects automatically is C:\Program Files (x86)\Microsoft Visual Studio 14.0
As per my understanding, all 64-bit programs/applications goes to C:\Program Files and all 32-bit applications goes to C:\Program Files (x86) from Windows 7 onwards.
Update: April 19th 2021
Microsoft announced their preview Visual Studio 2022 64 bit
Visual Studio 2022 is 64-bit
Visual Studio 2022 on Windows is now a 64-bit application. This means you can open, edit, run, and debug even the biggest and most complex solutions without running out of memory.
see https://learn.microsoft.com/en-us/visualstudio/ide/whats-new-visual-studio-2022
no, but it runs fine on win64, and can create win64 .EXEs
No, but the 32-bit version runs just fine on 64-bit Windows.
Is there any 64 bit Visual Studio at all?
Yes literally there is one called "Visual Studio" and is 64bit, but well,, on Mac not on Windows
Why not?
Decision making is electro-chemical reaction made in our brain and that have an activation point (Nerdest answer I can come up with, but follow). Same situation happened in history: Windows 64!...
So in order to answer this fully I want you to remember old days. Imagine reasons for "why not we see 64bit Windows" are there at the time. I think at the time for Windows64 they had exact same reasons others have enlisted here about "reasons why not 64bit VS on windows" were on "reasons why not 64bit Windows" too. Then why they did start development for Windows 64bit? Simple! If they didn't succeed in making 64bit Windows I bet M$ would have been a history nowadays. If same reasons forcing M$ making 64bit Windows starts to appear on need for 64Bit VS then I bet we will see 64bit VS, even though very same reasons everyone else here enlisted will stay same! In time the limitations of 32bit may hit VS as well, so most likely something like below start to happen:
Visual Studio will drop 32bit support and become 64bit,
Visual Studio Code will take it's place instead,
Visual Studio will have similar functionality like WOW64 for old extensions which is I believe unlikely to happen.
I put my bets on Visual Studio Code taking the place in time; I guess bifurcation point for it will be some CPU manufacturer X starts to compete x86_64 architecture taking its place on mainstream market for laptop and/or workstation,
Update: From the visualstudio 2022 preview site quoting https://web.archive.org/web/20211030202827/https://visualstudio.microsoft.com/vs/preview/:
Our 64-bit upgrade Take advantage of all your computer’s resources to scale Visual Studio to the largest of projects and complex workloads without running out of memory. You can continue to run and debug your 32-bit apps.
It seems they did what I was expecting they are dropping old 32bit support, quoting https://web.archive.org/web/20210910130939/https://learn.microsoft.com/en-us/visualstudio/extensibility/migration/update-visual-studio-extension?view=vs-2022:
Visual Studio 2022 RC is a 64-bit application, and introduces some breaking changes in the VS SDK
I want to thank every upvote for keeping this answer. As a thank you I want to add one more prediction: I still believe the trend will lean towards VSCode in time while VSCode forks or turns-into something like Eclipse Theia. Most probably they will give full support on cloud platforms with that. Especially for enterprises that will add great value and for the marketing sake I cannot find any better excuse about "move your onprem into the Azure" stuff. Anyhow seems we are correct about: Why Visualstudio was not 64 bit while it should be 64bit long ago,
Update: I think this will be the last update. Yes it was the direction I expected: https://vscode.dev/ deployed to public,

Resources