Memory Leaks in Java | Issues Caused and How to Prevent | Example

Поделиться
HTML-код
  • Опубликовано: 6 окт 2024

Комментарии • 56

  • @RanjitKumar-kb7zt
    @RanjitKumar-kb7zt Год назад +5

    Finally, I got to know after many years of experience. Thanks!!!

  • @saddammd
    @saddammd 2 года назад +6

    I thought these topics are only theoretical definition and it can't be visualised. Thanks for sharing your valuable knowledge.

  • @maankhurana5814
    @maankhurana5814 2 месяца назад +2

    Got to learn new thing todays ... Thanks buddy

  • @sarafarazahmadmomin1665
    @sarafarazahmadmomin1665 4 месяца назад +1

    Explain with perfect example

  • @bharathkl5229
    @bharathkl5229 6 месяцев назад +2

    I learned a lot , thank you ❤

  • @nikunjpatel8314
    @nikunjpatel8314 2 года назад +4

    Excellent explanation with visualization. Very nice tutorial 👌 👍

  • @utkarshvanjale749
    @utkarshvanjale749 2 года назад +3

    Really helpful please come up such interesting knowledgeable videos

    • @LazzyProgrammer
      @LazzyProgrammer  2 года назад

      Thank you Utkarsh for your valuable feedback 🙂

  • @DurgaShiva7574
    @DurgaShiva7574 Год назад +1

    one of the best videos which i have came across till date.. please keep up this good work!!

    • @LazzyProgrammer
      @LazzyProgrammer  Год назад +1

      Thank you so much for your feedback 😊
      Let's Keep Learning Together !!!!

  • @MrNareshProMax
    @MrNareshProMax Год назад +1

    thanks for sharing the knowledge in such a simple way. You are genious. Keep uploading such useful stuff.

  • @Rajesh-qk1ne
    @Rajesh-qk1ne 2 года назад +1

    Easy to understand.... Very good explanation sir 👍👍

  • @nidhi10sharma
    @nidhi10sharma Год назад +1

    Excellent explanation. Thank you very much!

  • @vjdreamworks2256
    @vjdreamworks2256 10 месяцев назад +1

    Well explained. Thanks for your efforts 🙏

    • @LazzyProgrammer
      @LazzyProgrammer  10 месяцев назад

      Thank you for your valuable feedback 🙏

  • @dptech79
    @dptech79 2 года назад +1

    Great explaination and it's very helpful

  • @pronavsandhu
    @pronavsandhu Год назад +1

    very informative video on an underrated topic. thank you !!

    • @LazzyProgrammer
      @LazzyProgrammer  Год назад

      Thank you for your feedback 🙂 Please do share the videos you like with your community as well. Let's share the knowledge.

    • @pronavsandhu
      @pronavsandhu Год назад +1

      @@LazzyProgrammer sure

  • @realknowledge-23
    @realknowledge-23 3 месяца назад +1

    very good content thanks a lot and all the very best.

  • @teeh6189
    @teeh6189 2 года назад +2

    Great video with easy to understand explanation. I have a question. I checked my hprof heap dump as I thought my application was causing memory leaks, but it turns out most of the memory is consumed by byte, char and Strings which are not from my application. How do I fix or avoid memory leaks in that case? Your response will be highly appreciated. Thanks

    • @LazzyProgrammer
      @LazzyProgrammer  2 года назад

      Thank you for your support and feedback 😊
      For the issue which you are currently facing. As there is no user defined classes which are causing the issue. You need to check the over usage of Strings in your application. Are you doing a lot of String manipulation? In such cases you may need to use StringBuilder/StringBuffer depending on the nature of your application (Single Threaded/Multi Threaded). Also, look for the connection objects and buffers, they must be closed after use. I will recommend to use try-with-resources if you are using Java 1.7 and above.

  • @clarencedonovan231
    @clarencedonovan231 Год назад

    Amazing. Thank you so much.

  • @kishordige9721
    @kishordige9721 Год назад +1

    Was helful

  • @syamnaidu5244
    @syamnaidu5244 Год назад +1

    Worth watching the video. Thank you ^_^.

  • @peterg76yt
    @peterg76yt 10 месяцев назад +1

    A static field, by itself, is not a memory leak. It's only a memory leak if memory is allocated but not released when no longer needed. If you need a list of doubles for the lifetime of the program, then keeping the data in a static field is an appropriate design. If at some point in the program execution they are no longer needed, just call List::clear.

  • @SohailKhan-pu2oi
    @SohailKhan-pu2oi 2 года назад

    Great Sir! keep sharing such awesome tutorials.

  • @poonamjadhao4990
    @poonamjadhao4990 2 года назад

    Nicely explain. Very useful.

    • @LazzyProgrammer
      @LazzyProgrammer  2 года назад

      Thank you Poonam, I am glad that it was useful...

  • @rocastone1349
    @rocastone1349 2 года назад +1

    super cool!!!

  • @JorgetePanete
    @JorgetePanete Год назад +2

    Correction: in java 9+, do not avoid string concatenation if the whole string is computed on a single operation (i.e. not in a loop), the compiler and runtime know enough for it to be optimal

  • @pravinjain2834
    @pravinjain2834 Год назад +1

    Why the populate method is not declared static, since it is only using static member?
    In that case to populate the list we will not need to create the object of the class.
    And when the list is no longer needed then it could be set to null, to let the garbage collector reclain it. It would not need the unloading of the class in such a case.

    • @LazzyProgrammer
      @LazzyProgrammer  Год назад

      Yes you can do it that way also, there should not be any issue. But to test the non static list anyway you have to make the populate method as non static.

    • @pravinjain2834
      @pravinjain2834 Год назад +1

      @@LazzyProgrammer Agreed, The idea is that whereever a method can be written as static(not dependent on instance), it should be declared static and invoked without using an instance.

  • @Rudar263
    @Rudar263 2 года назад

    Awesome

  • @nupurgulati9433
    @nupurgulati9433 2 года назад

    This is very useful 👍

    • @LazzyProgrammer
      @LazzyProgrammer  2 года назад

      I am glad it was useful. Thanks for sharing your valuable feedback 😊

  • @AmNotLegend
    @AmNotLegend Год назад

    how to run it from a MAC os

    • @LazzyProgrammer
      @LazzyProgrammer  Год назад

      Hello Yichun,
      You can download and install .dmg from visual vm's website for running it on Mac.

  • @JorgetePanete
    @JorgetePanete Год назад +1

    Soon to be a correction: the finally block is most of the time replaced by the try-with-resources, and the finally block will be removed in some future java release