The Java memory API

This section covers some of the unique constructs of the Java language, related to memory management.

Dreaming of delete or free operators for Java or trying to explicitly control the garbage collection behavior in a JVM by, for example, hanging on to objects longer than their natural lifespans is a sure way of shooting yourself in the foot. There are, however, some mechanisms in the Java language that make it possible to help the GC by giving it "hints". Some of the available mechanisms are good and some are bad. Some should be used with caution to avoid unwanted side effects.

Finalizers

In Java, since Java 1.0, every object contains a method called finalize that may be freely overridden by any implementer. The contract is that ...

Get Oracle JRockit now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.