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
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
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
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.
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
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
@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.
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."
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.. ❤
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
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"; }
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..
Completed watching on Oct 16, 2024 at 4.08 AM :)
Sir Thank you very very much. Your Teaching is excellent. From the bottom of my heart i am telling that your are best faculty.
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
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
Awesome Durga Sir, The way you explain the GC concept is extraordinary.
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
Indian guy with heavy accent and shitty microphone still 1000 times better than all those millions of tutorials on youtube❤
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.
Heavy accent xD.
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
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
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
@ instablaster =)
@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.
@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 !
Conclusion:- Almost all objects present inside a method eligible for GC except the following cases..
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."
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.. ❤
I can't understand why this dislikes, he is extraordinary.
179 video completed❤🎉
👍👍👍👍👍👍
Sir please make a video on java off heap memory requesting sir
Hello Kumar.
Plz contact our online team durgasoftonlinetraining@gmail.com or call us on this number +918885252627, 7207212427/28
Thanks so much, Durga Sir.
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
🥳👏👌🐎
sir plz upload remaining videos in garbage collection......
You have written s2=s1 in reassigning the variable , I think it should be s1=s2 .
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";
}
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..
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