When we encounter a java.lang.OutOfMemoryError, we often find that Java heap
dumps, along with other artifacts, are generated by the Java Virtual Machine.
If you feel like jumping right into a Java heap dump when you get a
java.lang.OutOfMemoryError, don't worry, it's a normal thought. You may be
able to discover something serendipitously, but it's not always the best idea
to analyze Java heap dumps, depending on the situation you are facing. We
first need to investigate the root cause of the java.lang.OutOfMemoryError.
Only after the root cause is identified can we decide whether or not to
analyze Java heap dumps. What is a java.lang.OutOfMemoryError? Why in the
world does it occur? Let's find out.
What Is a java.lang.OutOfMemoryError?
A java.lang.OutOfMemoryError is a subclass of java.lang.VirtualMachineError
that is thrown when the Java Virtual Machine is broken or... (more)
A couple of patterns that could cause Java heap exhaustion were identified
from years of research at IBM. One interesting scenario was observed when
Java applications generated an excessive amount of finalizable objects whose
classes had non-trivial Java finalizers.
What Is a Java Finalizer?
A Java finalizer performs finalization tasks for an object. It's the opposite
of a Java constructor, which creates and initializes an instance of a Java
class. A Java finalizer can be used to perform postmortem cleanup tasks on an
instance of a class or to release system resources such as file... (more)
We can visualize resource starvation using an elaborate rendition of the
Dining Philosophers Problem. This classic metaphor of resource allocation
among processes was first introduced in 1971 by Edsger Dijkstra in his paper
"Hierarchical Ordering of Sequential Processes." It's been a model and
universal method for verifying theories on resource allocation ever since.
The metaphor goes like this: There are three well-known philosophers in an
Asian bistro. Dinner is served but they are only given three chopsticks
because the restaurant's supply truck has been stuck in a snow storm f... (more)