Click to Play

Portability Key in New Verbatim...
Verbatim unveiled a variety of cool new products at CES 2010. Among them were the Tuff-'N'-Tiny USB drive, Titan SX portable hard drive, and the InSight...

Recent Articles

The Use And Understanding Of “?” Operators
Java includes a special Three-way(Ternary) operator that can replace certain types of if-then-else statements.These statements include assignment...

What Have We Learned From A Year Of...
This month marks the first anniversary of when my startup, M-Dot Network, started building our enterprise solution on Amazon's cloud computing platform.

Continued Education And IT Certifications
I have worked in the IT field for almost 10 years. One of the most controversial topics among most of the people I have worked with is whether or not certifications...

IT Giants Looking To More Social Centric...
Here are several excerpts from an article about what a panel of leading tech vendors had to say about the future of social networking tools at the Collaborate...


01.15.10

How To Use Garbage Data Collectors

By Vaibhav Pandey

A Garbage Collector must do two things:-

1.Detect garbage objects

2.Deallocate the memory of garbage objects and make it available for the program.

There are four approaches that a garbage collector may adopt to detect the garbage objects.

A) Reference -counting Collectors :-Reference counting garbage collectors keep a count of the references for the each live object. When an object is created ,the reference count of each object is set to one.When you reference the object ,the reference count is incremented by one. Similarly when a reference to an object is eliminated, the reference count is decremented by one. An object which has reference count zero is a garbage object when the object is garbage collected ,the references of the object that it refers to are decremented.Therefore garbage collection of the one may lead to the creation of other garbage objects.This method can be executed in small parts with the program ,and the program need not to be interrupted for a long time. However, there is an overhead of incrementing and decrementing the counter everytime something happens on the references side.


B) Tracing Collectors :-In this technique, a set of root is defined from where objects are traced. An object is reachable if there are objects that referenced and cannot ,therefore be accessed in the program.Objects that are reachable are marked. At the end of the trace, all marked objects can be garbage collected.
This is also known as the mark and sweep algorithm. The mark phase marks all the referenced objects. The sweep phase garbage collects the memory of unreachable and unreferenced objects.

C) Compacting Collectors :-These collectors reduce the degree of memory fragmentation by moving the all unused and free space on one side during garbage collection.The free memory is then available as one huge chunk.All references need to be shifted ,objects are the updated to refer to the new memory locations.

D)Adaptive Collectors :-This algorithm makes the use of the fact that different garbage collectors algorithm works better in different situations. The adaptive algorithm monitors the situation and uses the garbage technique that best suits the situation. It may switch from one technique to the other according to the need.

Comments


About the Author:
Vaibhav Pandey got offered employment from an Indian Multinational IT Company. He is 21 years old. He has a huge interest in Java programming and has liked it from his study days. Vaibhav loves to blog and share his experiences and thoughts. He now resides in Lucknow, a state capital in India. Check out his blog at http://javatutorialsworld.blogspot.com.
About ITCertificationNews
A collection of resources designed to assist IT professionals evaluating various certification programs within the IT world. IT Certification Articles and UPdates




ITCertificationNews is brought to you by:
SecurityConfig.com NetworkingFiles.com
NetworkNewz.com WebProASP.com
DatabaseProNews.com SQLProNews.com
ITcertificationNews.com SysAdminNews.com
DevNewz.com WirelessProNews.com
CProgrammingTrends.com ITmanagementNews.com



-- ITCertificationNews is an iEntry, Inc. publication --
iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509
2010 iEntry, Inc.  All Rights Reserved  Privacy Policy  Legal

archives | advertising info | news headlines | free newsletters | comments/feedback | submit article



IT Certification Articles and UPdates ITCertificationNews ITCertificationNews Home Page About Article Archive News Downloads WebProWorld Forums Jayde iEntry Advertise Contact