O'Reilly logo

Java™ Performance and Scalability, Volume 1: Server-Side Programming Techniques by Dov Bulka

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 6. Recycling

Regardless of continuous improvements in memory management speed, allocating and eventually discarding objects (via garbage collection) will always impose a nontrivial performance cost on Java programs. Moreover, object creation itself imposes an additional cost of properly setting the initial state of the constructed object via a constructor invocation. Object construction triggers the following steps [LY97]:

  1. Sufficient memory is allocated to hold all instance variables (object members) as well as those of each superclass.

  2. All instance variables of this class and those of each superclass are initialized to their default values (numeric variables to 0, boolean to false, reference types to null.)

  3. Proper values are assigned to ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required