Whenever we create a Java object by creating an instance of a class, it is always placed in an area known as the heap. This article is accompanied by a working code example on GitHub.
We will next analyze this heap dump to identify the potential objects which could be the cause of the memory leak. To see this in action, we will first trigger an OutOfMemoryError and then capture a heap dump. To investigate memory problems, the JVM Heap Memory is often the first place to look at. As Java developers, we are familiar with our applications throwing OutOfMemoryErrors or our server monitoring tools throwing alerts and complaining about high JVM memory utilization.