Out of memory issues

Hi there,

ReSharper (especially R# C++) is a fantastic product and helps me a lot during my day to day work.

We have quite a big code base at work (~ 500K LoC) in C++ and R# has serious issues to do its work without slowing me down.

Some of our code files are quite big and if I do a lot of refactoring and switching between multiple large code files, R# just swallows a huge amount of memory before doing GC and halting the whole IDE for 2-5 seconds.
Sometimes R# consumes > 2GB of memory and if that happens, the whole IDE becomes unusable and I can't even compile anymore because Visual Studio(32 bit process) cannot allocate any more memory I guess.

I known that our code files can be a bit messy so that might be one factor of the whole issue but I cannot change this right now.

Is it possible to solve this problem on your side?
I don't know much about extension development for Visual Studio but maybe you could spawn separate (64 bit) processes for the main parts of R# and only keep managing parts in the extension itself to solve the memory issue?
From what I can see after some quick Google searches there are a few developers having these issues.

I can imagine that my suggested solution would require quite a lot of time to implement so I only would like to know if this might be a solution for the future.

Comment actions Permalink

Hello Torben,

Thanks for the kind words!

Moving ReSharper out of process is in the works. We already did this with the Rider IDE (which is IntelliJ frontend with ReSharper as an out-of-process backend), but moving ReSharper out of Visual Studio is much more involved. We don't have a timeline for this change, hopefully early next year.

There are several ways to reduce memory usage at the moment:

1) You can exclude unneeded code in your solution from indexing via "Third-Party Code" options page (see https://www.jetbrains.com/help/resharper/Reference_Options_Code_Editing_Third_Party_Code.html).

2) Switch to Visual Studio 2017 if you haven't already. VS2017 provides a new API for reading project properties, which allows to not load the entire project model in memory on the VS side.

3) To reduce memory usage during debugging, try  /Debug:fastlink. Release notes for VS 15.7 state that "Debugging large solutions with /Debug:fastlink PDBs is more robust. Changes in the PDB lead to reduced latency and a 30% reduction in heap memory consumption in the VS Debugger.".

In any case, we would be interested to take a look at the memory snapshot if you can take one when memory usage is high - there's always a possibility of a memory leak or something else going on. The instructions are at https://resharper-support.jetbrains.com/hc/en-us/articles/115000265844-Collect-memory-snapshot-in-Visual-Studio, but note that a memory snapshot might contain some confidential data, since it's basically a dump of all managed memory. In our own tests memory usage on the LLVM+clang+clang-tools solution is OK (in VS2017), and on Unreal Engine 4 is acceptable, so it would be interesting what's causing excessive memory usage on your solution - 500K LOC is not a lot.


Comment actions Permalink

Hi Igor,

thanks for you reply, I'll report back later. Quite busy here at the moment


Please sign in to leave a comment.