Visual Studio – Understanding the Standard Collector Process and High RAM Usage

memoryvisual studiovisual studio 2015windows

Hopefully this is the right stack exchange site to post on… Didn't feel like it was a programming question for SO. Anyway, I'm running Visual Studio 2015 and got a notification to from Windows to close VS2015 because it's running low on memory. I have 24GB of RAM and just rebooted yesterday, so I think something is way off here. I sometimes use the C# interactive window, and python 2.7 interactive window, but those were not in use at the time of this message.

Note: As I'm writing this, I just got an "Unknown hard crash" message from devenv.exe (vs2015 process). But the Standard Collector service is still running using up 10.7GB.

Does anyone know what the Standard Collector is? And what might cause the RAM usage to spike?

Note: Again as I'm writing, I just noticed the Standard Collector Service stopped in my task manager and I have all my RAM back.

Large RAM usage by a Visual Studio "Standard Collector" process

Update: It sounds like this might be a bug that the VS team tried to fix in update 1. I definitely have update 1 installed, but perhaps I should try to reproduce in some sample code and send it to the VS team. The devenv instance that crashed was also not currently debugging. (Although, there is another instance where it is debugging as you can see by the .vshost.exe extension in task manager)

That devenv instance did not crash and it's actually still running in the debugger now without problems.

enter image description here

Best Answer

The Collector Process appears to be related to instrumentation/diagnostics of code running in debug mode, in Visual Studio 2015. Microsoft has acknowledged there is an issue with unbounded memory use of this process, and says,

We have researched the root cause and have made a fix that will be provided in VS2015 Update 1

So make sure you get the latest Visual Studio 2015 update. For mitigation in the meantime:

Meanwhile, if you notice that the process consumes too much memory you have two ways to recover. Simplest is just to restart your machine. That will get everything back to a fresh state. The other thing you can do to alleviate the memory consumption is to stop the Visual Studio Standard Collector Service using the Service Manager UI. The Name of the service is "VSStandardCollectorService140". It can be safely stopped when you not debugging with Visual Studio. If you stop the service while debugging (even stopped at a breakpoint) then the Diagnostic Tools window will display an error message after you resume the debug target process.

Look at this link, where the above quotes are sourced from.

This link also has a code example of someone who experienced this from a console app. It could be worth running that sample code to see if it triggers the issue on your system. The person who reported the issue also indicated it occurred intermittently, but running the code in Visual Studio debugging mode seemed to be the one common thread.

Possibly Microsoft fixed some root causes of the issue, but there are still other unfixed causes now surfacing.

Related Question