Minimizing object creation
Minimizing object creation is a critical concern when we are striving for high-performance applications. Every time we create an object, we use memory and processing resources. Although modern systems have an impressive array of memory capacity and processing capabilities, they are not limitless.
To ensure we handle this concern correctly, we should seek to understand the life cycle of a Java object, how object creation impacts memory, and what object pooling is. We should also experiment with different object initialization approaches and ways to reduce system overhead. That is the aim of this section. Let’s start our exploration of minimizing object creation by looking at the life cycle of Java objects.
Java object life cycle
The notion of an object in the Java programming language is nothing new. When considering high-performance Java applications, we need to consider the overall life cycle of our objects. The creation, use, and deletion...