Microsoft engineer shows how bad code can lead to your Windows PC slowing down

Microsoft engineer shows how bad code can lead to your Windows PC slowing down

Home » News » Microsoft engineer shows how bad code can lead to your Windows PC slowing down
Table of Contents

Home windows 10 is working out of assist quickly and as such Microsoft issued a reminder just lately. The tech large additionally printed a listing of Floor PCs that may’t improve to Home windows 11 as they do not meet the system necessities. The corporate’s official stance is easy: get a brand new system, ideally, a Copilot+ PC.

In the meantime, residence customers are additionally beginning to debate how they’d take care of this upcoming change. For these nonetheless on pre-2015 programs that may’t formally run Home windows 11, many really feel that Home windows 8/8.1 and never Home windows 11 and even Home windows 10, is the way in which to go, because the older OS feels snappier. Neowin readers additionally opined on the subject by sharing their ideas. You possibly can be part of the dialogue on this article.

Keep in mind although that whereas it’s a enjoyable subject to speak about, Home windows 8.1 assist ended again in January 2023, so it is not a safe choice to move again to.

A purpose for the slowness and sluggishness of a system is commonly dangerous underlying code that’s being run. Just lately, an editorial titled “Sloppy software program is why you suppose you want new {hardware}” authored by colleague David Uzondu, and it appears like a Microsoft worker would fairly agree with the concept if he had been to learn it.

Matt Hamrick, a Senior Escalation Engineer at Microsoft, has put up a weblog publish on Microsoft’s web site concerning this. The subject covers reminiscence leaks and out-of-memory (OOM) points that Home windows can encounter as a consequence of poor optimization.

Within the publish, Hamrick has used the instance of an up to date .NET 7 app to ascertain the premise explaining how a miscalculated ConfigurationBuilder entry for the reloadOnChange parameter can do that. By setting its worth to “true” as an alternative of “false”, an app can run into memory-leaking situations, resulting in a sluggish system or a program crash, if not a crash for your entire system.

For these questioning, the reloadOnChange parameter tells the system to observe a specified file for modified settings. It basically helps in dynamic reloading because it robotically reloads the up to date settings from reminiscence. Thus elements of an app that reference the set configuration can see the brand new values instantly, with out having to restart it. Therefore, that is basically what results in the out there reminiscence pool filling up over time.

He explains:

The affect of this code will likely be higher the extra typically it’s run. The issue isn’t obvious, however that is the set off: reloadOnChange: true.

….

reloadOnChange: true … is admittedly solely meant for use throughout app startup if a customized config file is being consumed that ASP.NET itself doesn’t already eat robotically (assuming these defaults have not been modified).

As an alternative, as talked about above, some of us have mistakenly used this code in one thing like a Controller motion or middleware part to achieve entry to some wanted config worth, not understanding what it is doing under-the-hood (additionally not understanding that the config they sometimes sought was already loaded (and monitored) into the app’s configuration system).

Matt Hamrick was capable of pin down the problematic code by observing a reminiscence dump from the GC (rubbish collector) .NET reminiscence supervisor utilizing numerous instruments like WinDbg, a Home windows debugging utility, amongst others. Yow will discover the total weblog publish right here on Microsoft’s Tech Neighborhood web site.

Though the instance highlighted right here is about an app initially coded in .NET 7, Hamrick notes that the issue isn’t particular to it and may have an effect on apps utilizing newer .NET variations too, that are nonetheless supported.

author avatar
roosho Senior Engineer (Technical Services)
I am Rakib Raihan RooSho, Jack of all IT Trades. You got it right. Good for nothing. I try a lot of things and fail more than that. That's how I learn. Whenever I succeed, I note that in my cookbook. Eventually, that became my blog. 
share this article.

Enjoying my articles?

Sign up to get new content delivered straight to your inbox.

Please enable JavaScript in your browser to complete this form.
Name