This project is read-only.

devenv.exe with 2,5GB MemoryUsage after turning on StyleCop in R#

Aug 19, 2011 at 9:03 AM


first of all I want to thank you for this great tool. It really helps me writing better code. I just found a bug, because I was forced to write a comment on a parameter and realized, that this parameter doesn't makes sense.

I just installed the new 4.6.1 version of Stylecop and it seems to work fine with R# 6. But after some refactoring the shown problems VS is getting VERY slow. I typed in a comment and I could get a cup of coffee and still some words haven't shown up .. every 5 second one character appeared. After this I checked the memory usage and it was about 2,5GB of RAM. Normally it's not getting oder 500MB.

Any idea what's wrong here?

Best regards

Aug 23, 2011 at 8:34 AM
Edited Aug 23, 2011 at 9:19 AM

Update - is this related to this other investigation?

I'm not seeing this on the projects here. I'll continue to monitor it. If anyone has some time and the ability to investigate then I'll be happy to fix once we have a confirmed repro.

Aug 23, 2011 at 9:25 AM

I've made some more tests to maybe give a clue, where the problem could be.

When I open my project in VS 2010 SP1 mit R#6 the memory gets to about 380MB - 480 with a big class opened that is in that project (about 3000 lines of code). When I reopen the solution this stays the same.

When I now activate StyleCop in R# and reopen the solution - it seems that I have to do this to make stylecop work - it gets to 600MB with this class open.

I used another spacing style some time ago, so stylecop has many suggestions what to fix. If I reformat a method with CTRL-K-F the memory rises slightly, but it makes a big jump, if I start to edit in the comments.

In one situtation it jumps 100MB up after I pasted a string with 40characters and corrected just one word. After a few minutes of refactoring the memory was already over 1000MB.


While I'm typing this reply here the memory gets back to 750MB, but the problem seems to have something to do with the comments. If I just edited a comment in top of a method and just typing in some usesless words. The memory jumps up over 200MB and right now it stays there ...



Aug 23, 2011 at 9:45 AM

Hi. If you are able to share the .cs file with me that'd be great so I can reproduce here.

Aug 23, 2011 at 10:57 AM

Sorry, but I can't give you the file ...


But I tried another thing, that could help you .. I just used an open source project I have on my disc and I think this could help to reproduce:


I used the nlog-source code from Here are my steps with the shown memory usage in task manager

1. Open VS (200Mb and after a few seconds it gets to 172MB)

2. Open NLog.netfx40.sln with no file open (322MB and later 234MB)

3. Open Logger-V1Compat.cs in NLog.netfx40 project (278MB)

4. Add a blank after the last parameter of

public void Log(LogLevel level, object value )

to see if StyleCop is working <- it doesn't seem to work

5. Close the file and rename it to LoggerV1Compat.cs. Add the blank again .. StyleCop seems to work .. maybe you can check that.

6. Foul around with the comments .. write something like "kjfhl dkgjoizhwj sdib oidj po dojß d hkldjlj " in the comment fields of some of the methods .. delete the dot at the end of some comments seem to have something to do with it ..

I end up with about 600MB after about 2minutes of wild typing, deleting, type again .. delete some dots .. delete some param-tags .. etc.

Something seems to come from R# itself because without stylecop I get the memory to about 400MB with this method, but styleCop seems to behave strange here.


Can you reproduce that?

Aug 23, 2011 at 1:03 PM

You're looking at 'Memory - Private Working Set' right?

I'll try and repro later when I get some time.

Aug 23, 2011 at 2:14 PM

Hi I have posted a fix for my memory Problems Maybe this solves this although

Sincerly Thomas

Aug 24, 2011 at 6:25 PM

So, I've investigated a bit - I've taken the fix described by Thomas. Using the open source project described above I saw this.

The reason it looks like StyleCop isn't running on the Logger-V1Compat.cs file is that there is an ExcludeFromStyleCop=true in the csproj for that file.

Starting VS in Debug on my box and the private working set is around 222MB.

Open the solution NLog.netfx40.sln and its 340MB.

It stays around the 320-340Mb level then.

Start editing and it slowly rises to 430MB.

But I don't see any delay in the ability to edit the file.

What I do see is that after you stop typing it takes R# a while to call the plugin, for the plugin to analyse the file and report the results back and therefore underline the issues.

After stopping editing it starts to drop to around 350-370MB.

So, is that better or not? Not sure. The memory fixes I have now will be in 4.6 builds shortly and you could re-test then. Anything I can repro here I will fix for you.

Aug 31, 2011 at 7:04 AM

I look forward to the new build also. I have had problems using VS2010 Premium/R# 6/StyleCop 4.6 latest if the file is over about 2000 lines lines long, when response is very slow and eventually a VS2010 crash. Breaking a class up into a series of partial files of some 500-700 lines and I get good response and no crashes.

The project I was edting was from

One of the large files to try editing is Algortithms.cs.

Aug 31, 2011 at 7:43 AM
Edited Aug 31, 2011 at 8:33 AM
Thanks tatworth. I'll check the latest 4.6 with the project and file you mention today.
Sep 2, 2011 at 9:13 AM

Hi all. For those helping with investigating memory and performable issues can you please install the debug build now uploaded. Follow the doc at 

Sep 2, 2011 at 9:27 AM

Using the PowerCollections project as a sample and editing the Algorithms.cs file. 4.6.1 was taking over 40secs to update the Tasks after a rightclick Run StyleCop. It now takes about 4 secs in 4.6.2.

Sep 2, 2011 at 10:26 AM

It looks better but not perfect. It now takes longer to raise the memory to over 2GB, but it still happens. The UI keeps more responsive. That's much better. Thx.

Where can I send you the log-file?

PS: The good thing about all this tests is, that I fix one style-problem after the other and comment a lot .. I think my collegues will like it :)

Sep 3, 2011 at 9:37 PM

I have also installed the debug version but have been unable to turn on the logging (the entry crashes VS2010). The debug version does run faster than the previous.

Sep 8, 2011 at 6:58 AM

I Initially had although crashes my solution for it was

1. Install Stylecop 4.6.2 and startup Visual Studio 2010 to see that it works

2. Change the config file (Add the configurations after the runtime entries not at the beginning (I think this caused the crash)).

Sep 16, 2011 at 8:03 AM


is there anything new on this topic?


Sep 18, 2011 at 9:25 PM

So 4.6.3 is available now. It includes several perf fixes over the past few weeks.

Sep 19, 2011 at 9:56 AM

I just wanted to inform you, that there are still some problems: After editing my > 2.000 lines code file and adding 3 comments for methods my memory usage raised from 500MB to 1000MB.

Sep 19, 2011 at 9:59 AM
Edited Sep 20, 2011 at 11:46 AM
Send me the file and the repro please.
Is this devenv.exe allocated memory from task manager or actual private bytes?
Sep 19, 2011 at 11:07 AM


as I can't send you the file I'm working on, I've tried to reproduce it and I think this could work:

- Open a VisualStudio with R#6 and StyleCop Plugin

- Create a new Console Project

- Add a new Class1.cs

- Edit Class1 and program something useless like this :

		public int DoSomething(int i, string s, double d)
			s = i.ToString("N0");
			int x = int.Parse(s);
			return x + (int)d;
- Copy this method and press CTRL-V until your code file is about 3.000 lines long (at this moment my VS had about 370MB in taskmanager)
- Now start adding comments over the methods by typing /// and type in any words that come to your mind. Add comment for the parameters too. Delete words, add them again and so on.
- Do this for about 10 methods.

My memory has raised to about 1GB at this point.

Can you repro this?


Sep 19, 2011 at 11:29 AM

I mean the memory shown in the column in taskmanager named private bytes for devenv.exe

Sep 19, 2011 at 11:37 AM
Edited Sep 19, 2011 at 3:16 PM
Cutting and pasting a method with the same name into class will mean it won't compile.
Stylecop doesnt run from r# until the class will compile.
Can you confirm your repro please and then try it again with the stylecop plugin disabled.
Sep 19, 2011 at 11:39 AM

I tried this with stylecop plugin disabled and the memory didn't raised over 400MB. Can't you repro this?

Sep 20, 2011 at 11:50 AM

Hi TomCat78,

Following the repro above I observed:

Pasting in the lines until I had 3000 of them VS had 349,704K of private bytes.

Adding comments /// for about 10-12 methods it went up to 394,248K.

Adding text into these comments and it dropped to 350,238K.


So, no where near the 1GB mark you were seeing. Do you have any other R# plugins installed? Any other VS addins other than R# installed?