Core Java With OCJP/SCJP: Garbage collection Part-2 || The ways to make object eligible for GC

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

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

  • @ranveervaghela7030
    @ranveervaghela7030 21 день назад +2

    Completed watching on Oct 16, 2024 at 4.08 AM :)

  • @svijayalakshmi2090
    @svijayalakshmi2090 Месяц назад +1

    Sir Thank you very very much. Your Teaching is excellent. From the bottom of my heart i am telling that your are best faculty.

    • @DurgaSoftwareSolutions
      @DurgaSoftwareSolutions  Месяц назад

      Hello Friend.
      Thanks for your valuable feedback. It will boost us to do new things. Please subscribe to get updates about new videos.
      You can view all other Core Java with SCJP/OCJP Videos by Durga sir in the following link:
      goo.gl/kqvaf2

  • @MrSATYAMJOSHI
    @MrSATYAMJOSHI 6 лет назад +2

    Man you are the God of java, Thanks a lot for this awesome explanation on GC, I really had a very big doubt about this concept, but after watching this all doubts are gone. Thank you again

  • @AJ-rk5kg
    @AJ-rk5kg 6 лет назад +4

    Awesome Durga Sir, The way you explain the GC concept is extraordinary.

    • @DurgaSoftwareSolutions
      @DurgaSoftwareSolutions  6 лет назад

      Hello Sabarinath.
      Thanks for your valuable feedback. It will boost us to do new things. Please subscribe to get updates about new videos.
      You can view all other Core Java with SCJP/OCJP Videos by Durga sir in the following link:
      goo.gl/kqvaf2

  • @xtodazxzibit1165
    @xtodazxzibit1165 4 года назад +7

    Indian guy with heavy accent and shitty microphone still 1000 times better than all those millions of tutorials on youtube❤

    • @arunk5307
      @arunk5307 3 года назад

      He mainly targets college students, maybe that's why he speaks with such accent. No other explanation I think, a man this intelligent, use such language.

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

      Heavy accent xD.

  • @afifkhaja
    @afifkhaja 4 года назад +3

    Thank you Durga! You explain concepts in an entertaining and easy to follow manner so I am able to pay attention and remember the material

    • @DurgaSoftwareSolutions
      @DurgaSoftwareSolutions  4 года назад

      Hello Afif Khaja.
      Thanks for your valuable feedback. It will boost us to do new things. Please subscribe to get updates about new videos.
      You can view all other Core Java with SCJP/OCJP Videos by Durga sir in the following link:
      goo.gl/kqvaf2

    • @emmettlachlan9770
      @emmettlachlan9770 3 года назад

      You prolly dont give a shit but does any of you know a tool to log back into an Instagram account..?
      I was dumb forgot my account password. I appreciate any tricks you can offer me

    • @warrenrohan8551
      @warrenrohan8551 3 года назад

      @ instablaster =)

    • @emmettlachlan9770
      @emmettlachlan9770 3 года назад

      @Warren Rohan I really appreciate your reply. I got to the site on google and I'm trying it out now.
      Looks like it's gonna take a while so I will reply here later with my results.

    • @emmettlachlan9770
      @emmettlachlan9770 3 года назад

      @Warren Rohan It did the trick and I now got access to my account again. Im so happy:D
      Thank you so much, you saved my account !

  • @EngineerVaibhav
    @EngineerVaibhav 11 месяцев назад +1

    Conclusion:- Almost all objects present inside a method eligible for GC except the following cases..

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

    Interesting. In modern C++ there was a big push to keep variables in the shortest scope that was needed. If we leave the references in scope, but with null assigned to them, it does seem slightly hazardous that someone will accidentally come along and try to use them, causing Null Pointer Exceptions that might only be seen as full test coverage is ensured (which should be almost immediately, but...). Keeping variables to the minimum scope needed seems preferable even in Java for that reason. I have similar concerns about the affect of re-assigning a new value (and possibly new logical meaning) to a reference variable. I used to do it all the time, but it doesn't help the readability of code logic.
    When you say "Objects created in a method are eligible for garbage collection when the method completes" that is confusing wording. It would NOT include those that are created inside a method but assigned to either a static or instance member variable, nor if it was added to an array or collection owned by the object, or owned by another object or the class, or by another class. So, I would say there "Objects assigned solely to local reference variables inside a method will be eligible for garbage collection as those local reference variables go out of scope."

  • @EngineerVaibhav
    @EngineerVaibhav 11 месяцев назад +1

    Four ways to make objects eligible for GC
    1) Nullifying the reference
    2) Reassignment of objects
    3) Creating Objects inside a method
    4) Island of Isolation.. ❤

  • @nanananou5117
    @nanananou5117 6 лет назад +1

    I can't understand why this dislikes, he is extraordinary.

  • @EngineerVaibhav
    @EngineerVaibhav 11 месяцев назад +1

    179 video completed❤🎉

  • @राजनगोंगल
    @राजनगोंगल 9 месяцев назад +1

    👍👍👍👍👍👍

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

    Sir please make a video on java off heap memory requesting sir

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

      Hello Kumar.
      Plz contact our online team durgasoftonlinetraining@gmail.com or call us on this number +918885252627, 7207212427/28

  • @rizwanshahid1447
    @rizwanshahid1447 6 лет назад

    Thanks so much, Durga Sir.

  • @sayyedyasin2025
    @sayyedyasin2025 7 лет назад

    Hello Sir,
    Thanks for the lecture.
    I have some doubts regarding nullifying reference variable.
    According to the description it is not necessary to make a local variable nullify of a method, because once we come out of the method the local references are no longer in use, the object created inside the method will be eligible for GC, if the method is not returns them.
    So will it be the responsibility of the programmer to take care of nullifying static variables only ?
    Thanks,
    Yasin Syed

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

    🥳👏👌🐎

  • @souravsaha7052
    @souravsaha7052 8 лет назад

    sir plz upload remaining videos in garbage collection......

  • @namrataojha4774
    @namrataojha4774 7 лет назад +1

    You have written s2=s1 in reassigning the variable , I think it should be s1=s2 .

  • @lokendrarawat4737
    @lokendrarawat4737 6 лет назад

    I have one question, i tried to google but could not get any satisfactory answer.
    How many object will be eligible for GC after compute method.
    many people have opinion that only 1 object will be GCed ie 'a'
    could you please explain 'str ' will be eligible for GC or not ? if not , then why ?
    SCP is part of heap , and is eligible for GC. This is what my understanding is .
    public void compute(Object p)
    {
    Object a = new Object();
    int x = 100;
    String str = "abc";
    }

    • @ramking5354
      @ramking5354 6 лет назад

      first of all the eligibility of "Object p" which is an argument for this method depends up on it reference variable assignment in caller method..
      about Object a,
      it is an local variable, and its variable scope ends with this local method, so it is eligible for GC! (return type is void and so no chance of new variable assignment to this object)
      about str,
      it is an String constant Literal, which will be created in SCP area (assuming SCP does not contains this String "abc" object earlier) after the completion of method..... compute(object p) all local variable will be destroyed including "String str"
      But SCP area will be destroyed at the time of system shut down(JVM), so, your String object "abc" too..
      SO, after compute() method completion
      Object a eligible,
      Object p depends up on its reference -------------
      But not object "abc"
      we can say 1 object eligible for GC
      SCP and Heap area are different... SCP is special memory allocation For String Literal Objects to overcome memory problems...
      I am a new bee... just going through Durga Sir Classes.. and my knowledge is only limited to Durga Sir's SCJP video classes.. Hope sir will correct if there is any mistakes..

    • @hangoutbuddy
      @hangoutbuddy 5 лет назад

      SCP is part of method area but not heap. So objects under SCP are destroyed during jvm shutdown..GC has no control over method area