Finding MEMORY LEAKS in C# .NET Applications
Vložit
- čas přidán 23. 06. 2024
- 🚀 C# Progress Academy - Become a job-ready C# and Angular web developer to land your dream developer role: bit.ly/45vbPUg
🏃♂️ THIS is how you can FIND MEMORY LEAKS in C# .NET Applications!
💻 Link to the Github repository! github.com/tutorialseu/csharp...
We'll make sure to make a Developer out of you in no time!
So, what is C#?
C# (pronounced "See Sharp") is a modern, object-oriented, and type-safe programming language. C# enables developers to build many types of secure and robust applications that run in .NET. C# has its roots in the C family of languages and will be immediately familiar to C, C++, Java, and JavaScript programmers. This tour provides an overview of the major components of the language in C# 8 and earlier. If you want to explore the language through interactive examples, try the introduction to C# tutorials.
To learn more, make sure to watch the video, and we promise you that you'll become a C# developer in no time! Have fun!
#csharp #dotnet #coding #tutorial #learn #microsoft #net #memory #memoryleaks #leaks
TAGS
dotnet,csharp,dotnet core,windows service,.net core tutorial,.net core,.net,c#,Tutorials,Tutorial,Programming,Course,Learn,Step by step,guide,programmer,core,code,c sharp,sharp,net6,6.0,memory leak,memory,leak,detective,.net framework,debugging,windbg,.net memory profiler,memory leaks net,programming,visual studio,profiling,windows 10,programming for beginners,how memory leaks occur,coding,software engineering,how to debug,debug,breakpoints
tutorialsEU offers you free video tutorials about programming and development for complete beginners up to experienced programmers.
This includes C#, Unity, Python, Android, Kotlin, Machine Learning, etc.
Stay tuned and subscribe to tutorialsEU: goo.gl/rBFh3x
Android: / @tutorialseuandroid
C#: / @tutorialseuc
Unity: / @tutorialseuunity
Facebook: / tutorialseu-1093802040...
LinkedIn: / tutorialseu
Discord: / discord
🚀 C# Progress Academy - Become a job-ready C# and Angular web developer to land your dream developer role: bit.ly/45vbPUg
@tutorialsEUC Note that the 'gcroot' command that you use here will no longer work as of 2023. They have dropped the -all option, as the tool and system are apparently fast enough now to just do -all everytime. So the correct usage is > gcroot
Unless I'm misunderstanding here, this is more "where your memory is being used." I don't see anything that I would call a leak here. Everything is intentional by virtue of that fact that statically scoped items are always in scope.
Yes, it's a "forgotten memory", but In the end this will cause a System.outofMemoryException, because memory won't be released until you will correct the code.
No memory leak, just increase of used memory due to the fact of using a static list.
very helpful, saved my day! thanks
Wow!! Thanks for it 👏🏻👏🏻👏🏻
You're welcome 😊
It is really helpful guide:)
Thanks for the help:)
Is it because the list is static and not collected by GC, there is having a memory leak? Could you please also explain why is there a memory leak here?
Exactly because the list is static, and it can't be collected, I think. Anyway, it's just an example.
It's not a memory leak. It just unbounded memory increase. This tutorial helps in debugging such issues, which causes the memory of the application to increase over time.
Its very hard to write code which leaks memory in languages like c#, since most of the code is managed. Only when you ( or the SDK you use) are not properly handling un-managed resources ( not disposing the IDisposible classes etc), do we get a memory leak and even then it is not a leak in managed code and so hard to debug using this method.
Great video!
gcroot -all [targetid] cmd is not working
Ok. In the real world application we have many threads, Lists, Arrays and probably the performance issue is not obvious like all examples about .net profiling. I need to study much more about this topic.
Quick questions , what is the average GC heap size for a Mobile Xamarin or Maui app ? It could be any app but I'm asking about a mobile app environment?
Why my program is not showing in the monitor list?
I learn some new CMD, Thanks. Add the fix for such code to make it consume less memory, then compare the result, it will be more helpful.
i know Microsoft recommends this, but all that is available in VS even in community edition. no need typing commands just using the profilers in VS.
Why just don't use Memory snapshot in VS and analyze by comparing two snapshots?
my Debian can not find dotnet-counters after installing. I'm destroyed
This topic i find it very complicated, couldn't understand it 😢
hi, what exactly don't you understand? :)
gcroot -all cmd is not working
But if I have a leak only on production environment how can I get this dump and analyze it?
cool, but unfortunately it is not memory leak
What do you mean?
Such a bad practise, you can do this all within visual studio itself, no need to install more tools..
Hi, Microsoft themself suggest to use this tool for first-level performance investigation: learn.microsoft.com/en-us/dotnet/core/diagnostics/dotnet-counters
I'd not say that this is a bad practicse but an introduction into the world of performance monitoring at all.
Greets,
Jannick
@@tutorialsEUC it's very bad though, and I fully don't understand why they are doing this, while in your diagnostics window you've everything you need :) nonetheless your video is still helpfull to search what you need cuz it's basically the same steps (just saves some typing and installing tools ;))
@@DutchRider Thanks for your honest opinion! 🙂
still dont know how to done this in VS, Can you show me content
p͎r͎o͎m͎o͎s͎m͎ 😏