Large objects

When designing and implementing an application, it is worth remembering to avoid allocating very large objects that are kept alive for a long time. The problems with these objects are that they have the potential to severely fragment the heap. Despite good GC strategies and improved defragmentation techniques, consequences can, in the end, be catastrophic for JVM, often in the shape of a java.lang.OutOfMemoryError error.

Large objects that have a short lifespan will be collected relatively fast and won't cause many problems. If these large objects are also allocated at the same time, they can be stored as continuous memory space, fragmentation can be kept to a minimum. They are also likely to be collected at the same time.

Another ...

Get WildFly Performance Tuning 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.