Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Memory leak?
bitrocks
#1 Posted : Tuesday, March 28, 2023 7:17:35 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 10/16/2017(UTC)
Posts: 5

Thanks: 2 times
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?
Remco
#2 Posted : Tuesday, March 28, 2023 11:16:24 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,161

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
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.
1 user thanked Remco for this useful post.
bitrocks on 7/13/2023(UTC)
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.025 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download