Skip to Content

Measuring and analysing the Memory consumption in Java and other OOP languages is not an easy task, because all the objects form a big highly connected graph. Only counting the flat, also called “shallow” size, of the objects, like for example the NetBeans profiler does, is not always helpful. If you have to figure out how much memory is spend by the several hundred applications/services running on your application server, you really need a more powerful tool to analyze a complete heap dump.

The question is then, whether there is a better way to measure memory consumption ?

Yes there is !

It’s called “retained size” and it was pioneered (at least as far as I know) by the yourkit profiler, but is now also the main concept that the SAP Memory Analyzer has been released is build around

Definition of Retained Set/Size:

The retained set for a leading set of objects (e.g. all objects of a particular class or all objects of all classes loaded by a particular class loader or simply a bunch of arbitrary objects) is the amount of memory which would be freed if all objects of that leading set would became unreachable, i.e. the retained set includes these objects as well as all other objects only reachable through these objects. The retained size is the total heap size of all objects contained in the retained set.

image

So in short, the retained size for a set objects is the amount of memory, that would be freed, if those objects could be removed from memory and a full garbage collection cycle would have been run.

The retained set can also be computed for single objects. The SAP Memory Analyzer, has special support for this through the dominator tree.

Definition of Dominator/Dominator Tree:

A node d dominates a node n if every path from the start node to n must go through d. The transformation of the object reference graph into a dominator tree allows us to easily identify the biggest chunks of retained memory.

image

The dominator tree views you, which are the biggest (in terms of retained size) objects in your heap. It also shows you, why an object is big, by providing a hierarchical view of the objects hold/retained by the object.

So go ahead an give the SAP Memory Analyzer has been released a try ! It’s really a big step forward in memory consumption analysis.

Regards,
Markus

To report this post you need to login first.

6 Comments

You must be Logged on to comment or reply to a post.

  1. Claudio Miranda
    How SAP expect professional developers working on linux to use SAP products ? Eclipse, SAP Server are available for linux, why eclipse based tools aren’t ?
    (0) 
    1. Markus Kohler Post author
      Hi Claudio,
      We want to ensure a high quality standard.  
      Additional platforms support would require more testing. Therefore for now only Windows is supported.
      If you develeopers ask loud enough for a Linux version, I think it should be possible to get a Linux version supported. Technically it’s not a problem (hint, hint 😉 ).

      Regards,
      Markus

      (0) 
      1. Claudio Miranda
        “We want to ensure a high quality standard.”

        If so, release early, because early adopters will tell you about the issues, any company won’t support beta/alfa software.

        For what I can see, eclipse and SAP Server already have a linux version. Probably, only the analysis tool needs some QA.

        Other companies already made linux version available. From that, I see SAP is losing developers market.

        I saw the screencast, and found out the analysis tool is good, but I cannot test it, nor recommend.

        I will not yell at anyone to ask SAP to release a linux version, as I understand this is a first class OS to support.

        (0) 

Leave a Reply