views:

680

answers:

3

IDE Configuration:

Visual Studio 2008 + Resharper 4.5.1 + Agent Smith 1.1.8. There is no any sophisticated configuration for last to add-ins.

Solution description:

33 class libraries + web site with 200+ pages.

Symptoms: After an hour of work under tuned on Resharper the IDE starts to throw the OutOfMemoryExection exceptions. Normal work is impossible only reopen Visual Studio can help.

Does anybody has such problem? Is it possible to configure Resharper to consume less memory? What Resharper feature does consume the most memory?

A: 

I have seen this and similar problems in the past with earlier versions of Resharper (and other similar add-ins) and large solutions, and is one of the reasons I try to stay away from them. The only solutions I know of were to restart Visual Studio, uninstall Resharper, or keep it turned off except for when you really need to use it.

For what it's worth, Visual Studio 2010 should help with these types of problems.

Scott Dorman
I'm curious, how will VS2010 help?
John Saunders
@John Saunders: The changes in the extensibility model for VS2010 should make it easier for add-ins like Resharper to get access to the code model which would mean less work for the add-in.
Scott Dorman
Unfortunately, as of VS2010 beta1, there is no satisfactory code model provided. So the problem will get even worse, because WPF (new editor) takes lots of memory :(
Ilya Ryzhenkov
@Ilya Ryzhenkov: Don't judge anything based on Beta 1 as there will be some major changes between Beta 1 and RTM.
Scott Dorman
+3  A: 

Welcome to the World of ReSharper. This lesson is called, "You get what you pay for".

Various features of ReSharper do require knowledge of your entire solution. This information takes memory. The solution-wide analysis may be the most memory-intensive, but even changing the signature of a public method requires knowing all the code that calls that method.

One thing you can do sometimes is to use smaller, "sub-solutions". If you are refactoring your DAL layer for instance, you only need the DAL and any unit test projects. What I sometimes do is to select the solution in Solution Explorer and use File->Save Solution As to save it with a different name in the same folder. I then remove projects until I'm left with those I want. Do not save the projects you're removing (save them before you start). When you've got the set you want, just do a Save All.

If it becomes too much of an annoyance, you can also get ReSharper to display the memory usage in the status bar. That feature has been available for a long time.

John Saunders
+3  A: 

If you're on 64-bit Windows (or you're happy to run 32-bit Windows with the /3GB switch), then you can configure Visual Studio to be /LARGEADDRESSAWARE, which, rather than 2GB, will give it 4GB (or 3GB on /3GB) of address space to play with.

See, for example, http://stevenharman.net/blog/archive/2008/04/29/hacking-visual-studio-to-use-more-than-2gigabytes-of-memory.aspx

Also, see the JetBrains page on the topic: http://www.jetbrains.net/confluence/display/ReSharper/OutOfMemoryException%2BFix

Roger Lipscombe