How Garbage Collector Works 1 Answer(s) 5 years and 3 months ago
Posted in : Java Interview Questions
how does Garbage Collection works?
View Answers
February 27, 2008 at 4:23 PM
Garbage Collection in Java
Garbage Collector Garbage collection" means objects that are no longer required by the program are "garbage" and can be thrown away. JVM?s heap stores all objects that are created by a running Java application. GC is the process that automatically freeing objects that are no longer referenced by the java program. JVM specification does not require any particular garbage collection technique. It doesn't even require garbage collection at all. More accurate and up-to-date definition of GC is "memory recycling." When an object is no longer required by the program, the JVM heap space it occupies can be recycled ,so that the new space is made available for newly created objects. GC somehow determine which objects are no longer referenced by the program and make available the heap space occupied by such unreferenced objects. The process of freeing unreferenced objects, the GC must run any finalizers of objects for freeing objects. Heap fragmentation occurs through normal program execution. In heap fragmentation new objects are allocated, and unreferenced objects are freed so that free portions of heap memory can be used for occupying by live objects. Requests for memory allocation by new objects is filled by extending the size of the heap even though there is enough total unused space in the existing heap. GC frees us from the burden of freeing allocated memory. GC know when to explicitly free allocated memory can be made available for new objects.
GC has the following advantages such as :-
(1) GC makes us more productive.Programming in non-garbage-collected languages face an elusive memory problem. Programming in Java using GC can avoid the problem of memory & scheduling . (2) GC helps ensure program integrity. GC is an important part of Java's security strategy.
GC has the following disadvantages such as :-
(1) Garbage-collected heap is that ,contains an overhead that can affect program performance. (2) Garbage-collected environment have less control over the scheduling of CPU time devoted to freeing objects that are no longer needed. (3) JVM has to keep track, which objects are being referenced by the executing program, and finalize and free unreferenced objects on the fly.
if you want more details about Garbage Collector with example go to following URL :
garbage collector - Java Interview Questions HowGarbageCollectorWorkshow does Garbage Collection works? Garbage Collection in JavaGarbage CollectorGarbage collection"... unreferenced objects on the fly. if you want more details about GarbageCollector
garbage collector garbage collector Hi
what is the adventage using system.gc() method ?
what is the adventage f annotation in java ?
how can we loads the spring...;Advantage of system.gc():
System.gc() runs the Garbage Collector.The JVM
Garbage Collection
;
In the example we are describing how the garbagecollectorworks... are creating three
objects to give the garbagecollector something to do, then we... in milliseconds
into a long type variable then calling the garbagecollector method
Garbage Collector Garbage Collector Hi,
Can any one please tell me what are the types of garbagecollector ??
Regards:
Akash
Java garbage collector
Java garbage collector What is the priority of Garbagecollector thread
Java Garbage collector
Java Garbage collector What kind of thread is the Garbagecollector thread? Hi Friend,
It is a daemon thread.
Thanks
Java garbage collector
Java garbage collector Does garbage collection guarantee that a program will not run out of memory? Hi,
The Java GarbageCollector does not guarantee of this.
Thanks
Java garbage collector
Java garbage collector Which is garbage collected first: Normal variables or static variables
What is garbage collection? - Java Beginners
. Howgarbage collection works in java?
Thanks
Garbage....
The Garbagecollector is responsible for running the Garbage collection process.... But Garbagecollector will finally decide weather to call Garbage collection
Garbage collector thread - Java Beginners Garbagecollector thread Hi,
Please let me know what kind of thread is the Garbagecollector thread?
Thanks Hi Friend,
It is a daemon thread.
Thanks
garbage collector - Java Interview Questions garbage collector what is the use of garbagecollector? Hi friend,
import java.util.Vector;
public class GarbageDemo{
public...;
for (int i = 0; i < size; i++) {
}
System.out.println("Garbage
Garbage collection Garbage collection why garbage collection? How it works?
Garbage collection is one of the most important features of Java. The purpose of garbage collection is to identify and discard objects that are no longer
Garbage Collector - Java Interview Questions Garbage Collector Why Database Connection object is not Garbage Collected? As we need to close the connetion manually, not like with other objects garbage collected
Java garbage collection
Java garbage collection How many times may an object's finalize() method be invoked by the garbagecollector
garbage collection in java
will learn how to force a garbagecollector to
work by creating many objects.... First of all we have created an object for the garbagecollector to
perform...(); method to show the time take by the garbagecollector.
import
Code for Garbage Collection
to force a garbagecollector to work by creating many objects.
Description... collection.
First of all we have created an object for the garbagecollector...();
method to show the time take by the garbagecollector
garbage collection garbage collection how to use garbage collection in program using core java
garbage collection - Java Beginners
then it will be automatically deleted by the garbagecollector.
It save the some amount..."algorithms.Instead of "destructor"
in c++ , java supports garbagecollector...garbage collection wat is the use of garbage collection  
Java garbage collection
Java garbage collection What is Garbage Collection and how to call it explicitly
java - Java Beginners
java how tha garbagecollector know that the object will be deleted? on which algorithm the garbagecollectorworks? what is the working principle of garbagecollector? How manay types of garbage collectors r
Getting garbage value
Getting garbage value Thanks for the reply. Its works well, but whenever I'm using numeric value from 0010 to 0757 it is returning some garbage value. I dont have the idea what is going wrong. Please give me some idea to solve
Garbage collection process in java - Java Beginners
In Java the Garbage collection process is known as GarbageCollector.
The Garbage....
Program can call the System.gc() method to call the GarbageCollector...Garbage collection process in java Name the process used for Garbage
How TCP/IP works ? How TCP/IP works ? hello,,
Can some body tell me how TCP/IP works?
hii,
TCP/IP is just a protocol that allows different nodes on the network/Internet to share resources and without TRANSMISSION CONTROL PROTOCOL
php garbage collection sessions - PHP
php garbage collection sessions i wanted to know more about the php garbage collection sessions.. how can i create and hold
VoIP Works
VoIP WorksHow VoIP Works
If you've never heard of VoIP...;
How VoIP Works-Busting Out of Long Distance Rates... over Internet Protocol, and how VoIP works is actually quite revolutionary because
Java Garbage Collection
. The garbagecollector determines
which objects are no longer referenced...
Java Garbage Collection
 ... on garbage collection. The name "garbage collection"
implies
Java: Garbage Collection
(collected). Automatic garbage collection is
the process of figuring out how...
Java: Garbage Collection
Garbage collection is the process of automatically finding memory blacks that are no
longer being used ("garbage"), and making
how to make this java mail works? - Java Beginners how to make this java mail works? Dear experts,
Recently, I borrowed a book by William Broden and managed to get the source codes from the author... don't have a clue how to make this file work at all, even after reading
How Fleet management System works
If you have a fleet and you are wondering how fleet
management system works or how can you can be benefited by managing your fleet,
than there is no need to get anxious any more.
Fleet management requires some skilled labor, software
How GPS Tracking System Works
Question arise in our mind "How does GPS Tracking system Works"? The Global Positioning system is a navigation system that is used to track objects like vehicles and mobiles. It is based on satellites, maps and computer software. People
How Ajax Works How Ajax WorksHow
Ajax Works
Ajax adds an extra layer of functionality in the communication
model. Ajax engine acts
How Web Hosting works? How Web Hosting works?
 ... the working of Web Hosting
service. We will explain you How Web Hosting works? Web... and running.
How Web Hosting works?
When user types website address
How jQuery works? How jQuery Works?
This section we will see how jQuery works with the help of simple program... from
the server.
So, jQuey is very useful tool. Let's see how it works
Access Modifiers and Garbage Collection
step further in version 2.0 garbagecollector is implemented as a
conservative collector. This enable users to use full functionality of C as well
as preserves...
Access Modifiers and Garbage Collection
 
How Voice over Internet Protocol (VoIP) Works
. It is still a mystery for them the how do voice over IP (VoIP) works. But using VoIP servies is very easy once you know how it works.
How VoIP Works?
Voice... change your idea of making telephone calls. How does VoIP or voice over internet
How does Email works How does Email works
Each Internet domain has email Server, when a user sends an Email…
Email client Program sends the message to Email server.
Email
How GPS Works? How GPS Works?
Introduction
GPS or Global Positioning System is a technology for locating....
The Idea behind GPS
The GPS system works with the help of a satellite network
How Struts Works How Struts Works
The basic purpose of the Java Servlets in struts is to
handle requests made by the client or by web browsers. In struts JavaServerPages
(JSP) are used
GPS Tracking: How it works
you can know the speed of an object, the distance traveled and how long it has
Java garbage collection
Java garbage collection Can an object be garbage collected while it is still reachable
Java garbage collection
Java garbage collection Can an unreachable object become reachable again
How Traditional Web Applications Works How Traditional Web Applications WorksHow
traditional web applications works?
This section explores the working of the browser in traditional
How Spring MVC Module Works How Spring MVC WorksHow Spring MVC Works?
In this we will see the request flow for the spring framework... to this
Servlet. It works as the front controller and handle all
Getting garbage value
Getting garbage value Thank You Sir for helping me out from the problem. Now I'm facing some problem with the value I'm passing to the textfield from the link gets some garbage value whenever I'm using some particular set
Getting garbage value
Getting garbage value Thank You Sir for helping me out from the problem. Now I'm facing some problem with the value I'm passing to the textfield from the link gets some garbage value whenever I'm using some particular set
How B2E E-Commerce works with Employees in Mind How B2E E-Commerce works with Employees in Mind
B2E – Business-to-Employee transactions have grown over the years as many industries now prefer to offer different kinds of services to their employees. The fascination