Getting a java.lang.OutOfMemoryError (OOM) message is quite common in Java applications if proper memory settings and best practices are not followed. So having a complete knowledge about OutOfMemoryError, its cause and solution is very important.
This book covers the following 10 OutOfMemoryErrors.
1.java.lang.OutOfMemoryError: Java heap space 2.java.lang.OutOfMemoryError: Unable to create new native thread 3.java.lang.OutOfMemoryError: Permgen space 4.java.lang.OutOfMemoryError: Metaspace 5.java.lang.OutOfMemoryError: GC overhead limit exceeded 6.java.lang.OutOfMemoryError: Requested array size exceeds VM limit 7.java.lang.OutOfMemoryError: request "size" bytes for "reason". Out of swap space? 8.java.lang.OutOfMemoryError: Compressed class space 9.java.lang.OutOfMemoryError: "reason" "stack trace" (Native method) 10.java.lang.OutOfMemoryError: Direct buffer memory
In this book, you will understand what a particular OutOfMemoryError is, what triggers it and what the different types of OutOfMemoryErrors are. This book also provides the guidelines on how to avoid getting an OutOfMemoryError in your application and how to fix it in case you encounter it in your application. This book also provides a source code examples which can be used to reproduce all these OutOfMemoryErrors. You can test these sample programs in your development machine for investigation purpose.