Simple Memory Optimizations trick for Java
Dr. Dobb’s | Optimized Java | June 1, 2006
I just learnt that Java 5.0 introduced a new StringBuilder class, which is a non-thread safe version of StringBuffer, i.e an internal array of characters acting as buffer for fast string allocation. (Remember that Java’s String is an immutable object allocated from a memory pool. It ’s a design tradeoff for quick reference vs. allocation), plus more about autoboxing (implicit conversion from primitive types to its wrapper object) and escape analysis to allocate objects from stack instead of from heap


