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]:
Sufficient memory is allocated to hold all instance variables (object members) as well as those of each superclass.
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
Proper values are assigned to ...