[go: nahoru, domu]

Jump to content

Wikipedia:Reference desk/Archives/Computing/2023 September 16

From Wikipedia, the free encyclopedia
Computing desk
< September 15 << Aug | September | Oct >> Current desk >
Welcome to the Wikipedia Computing Reference Desk Archives
The page you are currently viewing is a transcluded archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


September 16[edit]

.NET C# process memory usage utility for Windows?[edit]

Is there some kind of utility program for Windows that could attach to a .NET C# process and show as it is running, which C# objects the process is keeping in its memory and how much memory they are using at the moment? JIP | Talk 18:05, 16 September 2023 (UTC)[reply]

A sufficiently good debugger or profiler.
I have no real experience with C# or .NET I'm afraid. Do .NET runtimes have debugging or profiling options? If so that might be all you need. Here's MS on .NET profiling. Some searching along the lines of "dotnet profiler" may be profitable. 47.155.41.104 (talk) 06:58, 17 September 2023 (UTC)[reply]
Oh also I should have mentioned this as it possibly may wind up saving you from wasting a lot of time. As noted in the MS article, if the C# code winds up itself calling into "unmanaged" (non-.NET) code, e.g. it calls into a C or C++ library, C# profiling by itself can't tell you anything apart from, the leak's in there somewhere, and a C# debugger can give you the stack trace. If it turns out the leak is in the library, if you want to diagose it you have to then switch into debugging that lib, which is more involved. Tip: you will need debug symbols for the binary loaded into your profiler/debugger (or a binary compiled with them).
This is distinct from either the .NET runtime, or underlying code called by the runtime like the Win32 API, leaking memory. If that happens you've probably found a bug in one of those! Might want to report it, but in the meantime you might be able to work around it. 47.155.41.104 (talk) 22:21, 17 September 2023 (UTC)[reply]