Finding MEMORY LEAKS in C# .NET Applications

Поділитися
Вставка
  • Опубліковано 15 вер 2024

КОМЕНТАРІ • 40

  • @tutorialsEUC
    @tutorialsEUC  Рік тому +1

    🚀C# Progress Academy - Become a senior C# developer: academy.tutorials.eu/p/csharp-progress-academy

  • @gavinw77
    @gavinw77 8 місяців тому +6

    @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

  • @rpreviato
    @rpreviato 12 днів тому

    Your video help me to fix an issue on a Worker service I was working with, that was accumulating 25GB of RAM over few days. Thank you!

  • @bogdan98ful
    @bogdan98ful 10 місяців тому +6

    No memory leak, just increase of used memory due to the fact of using a static list.

  • @UnashamedlyHentai
    @UnashamedlyHentai Рік тому +7

    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.

    • @ridgero
      @ridgero Рік тому

      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.

  • @ishaarora3
    @ishaarora3 Рік тому +6

    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?

    • @shishlinsv
      @shishlinsv Рік тому

      Exactly because the list is static, and it can't be collected, I think. Anyway, it's just an example.

    • @bhanuprakashrao1460
      @bhanuprakashrao1460 Рік тому +5

      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.

  • @ncvjr
    @ncvjr Рік тому +3

    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.

  • @DelMadman
    @DelMadman 3 місяці тому

    very helpful, saved my day! thanks

  • @user-yr9yn8yx2e
    @user-yr9yn8yx2e 6 місяців тому

    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.

  • @user-kr9gc6ys2
    @user-kr9gc6ys2 11 місяців тому

    It is really helpful guide:)
    Thanks for the help:)

  • @EdRawrDev5813
    @EdRawrDev5813 4 місяці тому

    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?

  • @alexnovikov4356
    @alexnovikov4356 Рік тому

    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.

  • @SakthiVel-hq6zu
    @SakthiVel-hq6zu 10 місяців тому +2

    gcroot -all [targetid] cmd is not working

  • @FranciscoAlvino
    @FranciscoAlvino Рік тому

    Wow!! Thanks for it 👏🏻👏🏻👏🏻

  • @nursultanesirkegenov3289
    @nursultanesirkegenov3289 8 місяців тому

    Why just don't use Memory snapshot in VS and analyze by comparing two snapshots?

  • @rodrigoramirez3870
    @rodrigoramirez3870 Рік тому

    Great video!

  • @Cod3rMax
    @Cod3rMax Рік тому +2

    This topic i find it very complicated, couldn't understand it 😢

    • @tutorialsEUC
      @tutorialsEUC  Рік тому

      hi, what exactly don't you understand? :)

  • @baebcbcae
    @baebcbcae 9 місяців тому +3

    cool, but unfortunately it is not memory leak

    • @darkmalk94
      @darkmalk94 9 місяців тому

      What do you mean?

  • @SDChillRide
    @SDChillRide Рік тому

    Why my program is not showing in the monitor list?

  • @hiryu70
    @hiryu70 Рік тому +1

    But if I have a leak only on production environment how can I get this dump and analyze it?

  • @SakthiVel-hq6zu
    @SakthiVel-hq6zu 10 місяців тому

    gcroot -all cmd is not working

  • @user-rv9ug9ur1x
    @user-rv9ug9ur1x 5 місяців тому

    my Debian can not find dotnet-counters after installing. I'm destroyed

  • @DutchRider
    @DutchRider Рік тому +2

    Such a bad practise, you can do this all within visual studio itself, no need to install more tools..

    • @tutorialsEUC
      @tutorialsEUC  Рік тому +1

      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

    • @DutchRider
      @DutchRider Рік тому +1

      @@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 ;))

    • @tutorialsEUC
      @tutorialsEUC  Рік тому

      @@DutchRider Thanks for your honest opinion! 🙂

    • @dellosCao
      @dellosCao Рік тому

      still dont know how to done this in VS, Can you show me content

  • @emmacox9506
    @emmacox9506 Рік тому

    p͎r͎o͎m͎o͎s͎m͎ 😏