Special Sauce
Special Sauce

Reputation: 5594

slow, long-term memory leak in .NET Framework 4.7 Windows app -- Perfview shows System.Diagnostics.NtProcessInfoHelper.CachedBuffer culprit

I have a .NET Framework 4.7 Windows Forms app that does client/server network communication and runs for long periods of time. Over a period of multiple weeks, it becomes clear there is a memory leak as the working set continues to grow and grow slowly (maybe ~5 MB a day on average). Forcing a garbage collection over all generations does reduce the current working set size, but only to a minimum size, which slowly grows day after day as previously described. I have used Perfview to identify the culprit in the Diff Heap Stacks window, which is System.Diagnostics.NtProcessInfoHelper.CachedBuffer. See the included screenshot below. This same class continue to grow day after day (for example, if I do incremental daily diffs), so it is definitely the culprit.

Perfview Diffs window

The problem is I can't figure out where/how any objects of this class are being instantiated. The app has about 5-6 library dependencies. These include BouncyCastle, JSON.Net, Websocket4Net, SuperSocket, and MySql .NET Connector. I have searched the latter 3 library's source codes for the text for the text NtProcessInfoHelper and CachedBuffer and found no hits so far. There are some using System.Diagnostics; sprinkled throughout the sources--I have not gone through them all yet.

There is not very much information online regarding either of these two classes. Does anyone have any ideas or suggestions on where this memory leak might be occurring or how I could track it down to a specific library or app source? Is anyone familiar with a more commonly used class that internally invokes System.Diagnostics.NtProcessInfoHelper.CachedBuffer?

Upvotes: 0

Views: 32

Answers (0)

Related Questions