Home | Business News | Browse by Publication | J | Java Developer's Journal

Know your worst friend, the garbage collector: it can make or break performance.

Publication: Java Developer's Journal
Publication Date: 01-MAY-05
Format: Online - approximately 2503 words
Delivery: Immediate Online Access

Article Excerpt
All Java programmers are aware of a peculiar entity living in their Java Virtual Machine known as the Garbage Collector. Although we all use it every day, only a few of use know exactly what it is and how it works. Unquestionably useful, the Garbage Collector can hurt the performance of your application without you even knowing it. In this article you will learn about its inner workings and understand how to tame it to boost your programs.

The Garbage Collector, which I will call GC from now on, is a benevolent sentinel present in every JVM. Its role is to identify and free chunks of memory left unused by the currently running application. Its job should shed some light on the origin of the name "garbage collector." Despite the depreciating name, the GC is like Dilbert's garbage man who is very smart, even smarter than you sometimes.

During its lifecycle, an application creates a certain number of objects, that is to say a certain amount of data that consumes memory and lasts according to its role in the inner workings of the application. Let's take the simple example of a Web browser. The object corresponding to the window you look at has exactly the same life span as the application itself, while the object standing for the Google logo on the google. corn front page lasts only as long as you're on the page. As. a matter of fact, an application spawns a large amount of shortlived objects during its life span. So you can understand that defining and controlling the lifecycle of every single object generated by an application demands a tremendous amount of work from developers.

A simple example should give you a better idea of the incredible number of objects that are born and then killed. When you open a plain text file in a text editor, in our case Jext, 342,997 objects are created and destroyed. Even the simple conversion of a pound to kilograms entails the birth and the death of more than 171,000 objects in Numerical Chameleon. Imagine if the programmer had to know exactly how to handle every single object during an application's lifecycle. Yet, the slightest error can prove disastrous; this is how infamous...

View this article FREE - Now for a Limited Time, try Goliath Business News
Free for 3 Days!



More articles from Java Developer's Journal
Sun Java application platform suite achieves best-in-class.(Industry N..., May 01, 2005
Dieselpoint Search version 3.5 released.(Industry News), May 01, 2005
Wily Technology offers breakthrough Web application browser response m..., May 01, 2005
Oracle Fusion Middleware enhances application foundation for enterpris..., May 01, 2005
NuComm International uses JReport to boost productivity.(Industry News..., May 01, 2005

Looking for additional articles?
Search our database of over 3 million articles.

Looking for more in-depth information on this industry?
Search our complete database of Industry & Market reports by text, subject, publication name or publication date.

About Goliath
Whether you're looking for sales prospects, competitive information, company analysis or best practices in managing your organization, Goliath can help you meet your business needs.

Our extensive business information databases empower business professionals with both the breadth and depth of credible, authoritative information they need to support their business goals. Whether it be strategic planning, sales prospecting, company research or defining management best practices - Goliath is your leading source for accurate information.