Have you ever asked yourself how much you contribute to the overall Java heap memory consumption of your application or application server? No?
In my last blog I wrote about the class loader grouping which is a very effective means of accounting memory per deployed component. However, this is more of interest to someone in need of an overview about the overall memory consumption. If you are interested only in your own component, please try out the retained set function of the SAP Memory Analyzer. It will look up for you all the objects from your Java packages and determine what they keep alive. That means you would even see the String which is stored in your object and the char underneath. Everything you are responsible for, not only your own classes!
Just hit the toolbar button “Calculate retained set for packages” and supply a regular experssion for your Java packages. You will see the amount of memory you have used up and a class histogram of the objects you have used. From here you can group by class loader to get a better overview of the other components you have used.
That’s a very good starting point for exploring a specific package! Please use it and help your application or application server to use less memory and run more stable without OutOfMemoryErrors.