Home arrow Java & J2EE arrow Page 3 - The Genius of Java

Memory Management Through Garbage Collection - Java

In this first chapter from the book The Art of Java by Herbert Schildt and James Holmes, the authors highlight certain features of the Java programming language that separate it from other languages. The chapter also covers: memory management, Java's built-in support for multithreading, Java's approach to exceptions as compared to C++, Java's support of polymorphism, and how bytecode enables Java's "Write Once, Run Anywhere" ability and provides security. (ISBN 0-07-222971-3, McGraw-Hill/Osborne, 2003).

TABLE OF CONTENTS:
  1. The Genius of Java
  2. Simple Types and Objects - The Right Balance
  3. Memory Management Through Garbage Collection
  4. A Wonderfully Simple Multithreading Model
  5. Fully Integrated Exceptions
  6. Streamlined Support for Polymorphism
  7. Portability and Security Through Bytecode
  8. The Richness of the Java API
  9. The Applet, and The Continuing Revolution
By: McGraw-Hill/Osborne
Rating: starstarstarstarstar / 69
May 05, 2004

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Garbage collection as a memory management technique has been around a long time, but in Java it took on a new life. In languages such as C++, memory must be managed manually, with the programmer explicitly releasing unused objects. This is a source of problems because it is common to forget to release a resource after it is no longer needed, or to release a resource that is still being used. Java prevents these problems by managing memory for you. This can be done in an efficient manner because all objects in Java are accessed through a reference. Thus, when the garbage collector finds an object to which there is no reference, it knows that the object is unused and can be recycled. Had Java allowed objects to be operated on directly (in a fashion similar to the simple types), then such an efficient means of garbage collection would not have been possible.

Java’s use of garbage collection reflects the philosophy of Java in general. The Java designers took great pains to create a language that would prevent some of the problems typical of other programming languages. By using garbage collection, it is not possible for the programmer to forget to release a resource or to mistakenly release a resource that is still in use. Thus, garbage collection heads off an entire class of problems.

Remember: this is chapter one of The Art of Java, by Herbert Schildt and James Holmes (McGraw-Hill/Osborne, ISBN 0-07-222971-3, 2003). Check it out at your favorite bookstore today.  
Buy this book now.



 
 
>>> More Java & J2EE Articles          >>> More By McGraw-Hill/Osborne
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

JAVA & J2EE ARTICLES

- More Java Bugs Lead to More Attacks
- Oracle's Java One Brings News, Surprises
- Oracle Patches Java Runtime Environment
- Apple Syncs Java Update with Oracle
- Spring 3.1 Java Development Framework Compat...
- Jelastic Java PaaS Availability and Pricing ...
- NetBeans 7.1 Released, Supports JavaFX 2
- SolarWinds Releases Newest Version of Java M...
- Free Monitoring Tool for Java Apps on Heroku
- Heroku Adds JCloud Platform Support, Java 7 ...
- Java SE 8 Speculation in Full Swing
- Java SE 7 Now Available
- New JVM Language and Java Reporting Tool
- Java 7 Release Update and New Eclipse Toolkit
- The Best Java Netbeans IDE Plugins

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: