Daily Usage Issues

Memory leak?

Started by bitrocks on 1,436 views

We've been happily using NCrunch for years without any issues worth mentioning. But since a few days we're experiencing a memory leak which causes Visual Studio to take up all available memory, grinding everything to a halt.

We have the task manager permanently opened so, we can easily kill the .NET host process responsible, running under Visual Studio 2022. That frees up the memory allowing us to continue again, until it builds up again. It doesn't build up gradually however. VS is running fine and then in a very short amount of time the memory usage spikes.

Yesterday we found out that disabling NCrunch also frees up the memory, so we're assuming it is NCrunch related.

We're currently on 4.16.0.4 and since we've been using that version for longer that a few days ago, it's unlikely to be due to the update.

So it may be related to our own code. But it's not that straightforward as all of our tests do pass just fine.
Obviously we could try isolate the problematic unit tests by disabling them groupwise until the problem no longer occurs, but it can take a few hours for the leak to occur and with 8000+ tests that's not a very efficient way of doing things.

Does anybody have any ideas on how to figure out what is causing this exactly?

Edited

Hi, thanks for sharing this issue.

At the moment we aren't aware of any memory leaks in NCrunch itself that could cause this kind of behaviour, but when there are 8000+ tests involved, sooner or later this is probably going to happen.

It's not an uncommon problem either. It's not easy to verify cleanup operations for each test, and leaks can be quietly introduced without anyone being aware of it until much later down the line.

A while ago we added a feature that more or less negates this problem. Set the test process memory limit in your NCrunch configuration to something sensible. If a test run completes and the runner EXE is holding more memory than the limit, it will be automatically recycled and the problem is gone. Unless you're leaking memory like a garden sprinkler, you likely won't notice any loss in performance as the recycling of the processes will be infrequent enough to not have an impact on your test cycle times.
This post has been deleted.
This post has been deleted.
This post has been deleted.

Post a reply

Log in to reply.