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

Notification

Icon
Error

Finding Memory Usage Per-Test
b33rdy
#1 Posted : Wednesday, February 2, 2022 11:33:24 AM(UTC)
Rank: Member

Groups: Registered
Joined: 6/28/2016(UTC)
Posts: 20
Location: United Kingdom

Thanks: 17 times
Was thanked: 5 time(s) in 4 post(s)
Is there a way of displaying the amount of memory used per-test within NCrunch?

We have an odd CI issue where some tests are using so much memory it's crashing the process, and we're trying to track it down. I was hoping to be able to show the rough memory usage per-test when running in NCrunch? It would help us narrow down where to look...
Remco
#2 Posted : Wednesday, February 2, 2022 12:10:05 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,976

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Hi, thanks for posting.

We don't have anything built-in that can do this. Given that the tests themselves are your own code, perhaps it might be possible for you to engineer something into the tests themselves? For example, you could create a SetUpFixture that starts a background thread which monitors the amount of memory in use in the process. When the memory usage hits a threshold, it enumerates all threads in the process and captures the stack trace of each one, then writes this to a file on disk.

Something else you could try is to declare the NCrunch.Framework.IsolatedAttribute at assembly level in your test projects. NCrunch will then run each fixture in its own process. This might help reduce the data you need to sift through if you can identify a specific process that's eating more than it should.
b33rdy
#3 Posted : Wednesday, February 2, 2022 12:58:47 PM(UTC)
Rank: Member

Groups: Registered
Joined: 6/28/2016(UTC)
Posts: 20
Location: United Kingdom

Thanks: 17 times
Was thanked: 5 time(s) in 4 post(s)
Unfortunately there are a number of xunit-based tests, so doing the SetupFixture equiv involves a bit of work.

I don't think NCrunch is the right tool for this job entirely, it was just a hope really to help track something down! Cheers!
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.031 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download