Can the Garbage Collector be forced to run? ||Java Interview Question 2021
Автор: Engineers choice tutor
Загружено: 2021-01-25
Просмотров: 143
Описание:
Can the Garbage Collector be forced to run?
Java Interview Question 2021
No, we cannot force garbage collector to run i.e. to destroy objects, but we can request it.
We have a method called “gc( )” in System class as static method and also in Runtime class as non-static method to request JVM to start garbage collector execution.
So, we can call it in our program as below:
System.gc( )
Runtime.getRuntime( ).gc( )
One can request the Garbage collection to happen from within the java program but there is no guarantee that this request will be taken care by JVM.
#java
#javainterviewquestion
#garbagecollectorjava
#gcconceptjava If you want to help us for enlarging our channel, then please donate us by your own wish:
Paytm: 7509058785
Upi: 7509058785@ybl
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: