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

Java

Video is ready, Click Here to View ×


java
Basic Java Tutorial for beginners
Basic Java Programming for beginners
Core Java By Durga Sir
Core Java
Core Java Video Tutorials
Core Java Tutorial for beginners with examples
Core Java Tutorial
Core Java DURGASOFT
Durgasoft Core Java
Durgasoft Java
durga software solutions core java videos
durga software solutions java
How to learn java
How to learn java programming language for beginners
learn java
learn java programming for beginners
programming in java
understanding java
java…

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

  1. Hi Sir,
    As there are four ways to make an object eligible for GC which are nullifying, reassignment, inside methods, and island of isolation.These methods don't cover a talk about anonymous object. If any anonymous object is created then It doesn't have any reference. How does an anonymous object work?
    For example, new Student().getSalary(). In this scenario, student instance doesn't have any reference. Weather is it eligible for GC or not?
    Could you please get some insights on the same?

  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

  3. 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";

    }

  4. 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

Leave a Reply

Your email address will not be published. Required fields are marked *