question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Huge memory consumption by running dotnet even with just a -? switch

See original GitHub issue

Issue Description

When I type just dotnet -? or dotnet build -?, it makes huge memory consumption. the machine is Win7, the .NET is the latest. here is a nicey screenshot, screwed up a bit by jpg though:

dotnetbuildramhog

of 8GBs of RAM almost all is consumed, even though performance monitor shows 1 or 2 dotnet instances, each having around 600MB commit, but significantly smaller working sets (380KB of a private set, when running just dotnet -?). especially for the 2nd one. still, it gets noticeable, that the system pages out a lot, other programs lag after this (black rectangles on screen instead of their client areas). the disk is 5400rpm, not NVMe SSD.

Steps to Reproduce

just typing dotnet [build] -? or biulding a simple “hello world” in the specified below environment is enough to reproduce it.

Analysis

when running dotnet. both from CLI and VS. no more ideas.

looking at the screenshot, it’s seen, that the amount increases (for several seconds duration), by 4GB. even though, the dotnet process commit is ~500MB. as said, the working set (any) is way smaller. if that is just a confusion of the counters, why other programs experience the lag, very well observable on the GUI? I don’t know if modified time on the pagefile is an accurate measure of paging happened, but while posting this and making the screenshot, the pagefile modified time remained with 6 hours ago.

Versions & Configurations

>msbuild -version
MSBuild version 17.4.1+9a89d02ff for .NET Framework
17.4.1.60106

dotnet CLI and VS IDE. the latest VS (downloaded yesterday). Windows 7 x64.

Regression?

I don’t know, since I am a C guy and always have been using MSVC and nmake from command line.

Issue Analytics

  • State:closed
  • Created 8 months ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
teo-tsirpaniscommented, Feb 5, 2023

It would work but I would recommend you to add it to each repository for consistency among all its developers.

1reaction
teo-tsirpaniscommented, Feb 4, 2023

MSBuild 17.4 runs on .NET 7. You should add a global.json file to your repository limiting the SDK version to 6.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Very High Memory Usage in .NET 4.0
The exact same service running on 4.0 uses between 3GB and 5GB+ of memory, and gets less than 4 X per second. In...
Read more >
An empty .NET 7.0 app allocates huge amount of memory ...
NET 7 process allocated huge amount on memory just in Main(). ... Huge memory consumption by running dotnet even with just a -?...
Read more >
Troubleshooting high memory usage with ASP.NET Core ...
Chasing down why ASP.NET Core applications might use unreasonably much memory in Kubernetes, and how to it can be mitigated.
Read more >
Troubleshoot Out of Memory issues - ASP.NET
It all assumes that you aren't running with the /3gb switch enabled. When an application needs to use memory, it reserves a chunk...
Read more >
Find, Fix, and Avoid Memory Leaks in C# .NET: 8 Best ...
The first core cause is when you have objects that are still referenced but are effectually unused. Since they are referenced, the garbage ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found