Object count from API differs that from UI

Questions about YourKit Java Profiler
Post Reply
jagadeesh
Posts: 5
Joined: Wed Nov 17, 2004 11:29 pm

Object count from API differs that from UI

Post by jagadeesh »

I posted this in the bugs forum, but was unable to get it addressed. Since there are other folks in this forum who are interested in taking automated snapshots over time and possibly automated analysis, I may have a better luck here.

A memory snapshot can be analysed using the API. In particular, various instances of a package can be analysed to print the number of instances, the shallow and the retained size of these instance. The package level data should be the sum of all the class level data in that package.

I find that the instance count and the sizes printed for a package via API are sometimes different from the data that the profiler UI presents for the same package. I can not understand how that can happen.

I am trying to promote this tool in the company but I am not able to explain this to my colleagues. I am looking for some help here.

Here is what I did.

Assume a package pkgA.
pkgA contains three classes c1, c2, c3

A point-in-time memory snapshot of an application is taken that contains instances from these classes. Upon opening the snapshot in the profiler UI, in the All Objects tab, 'class tree' is selected and it is noticed that pkgA has one instance with some retained memory. Expanding the pkgA tree shows that c1 owns that instance.

Using the API, the object count for "pkgA.*" is determined to be, say 100.

What explains this difference? Why does the UI not show the number of instances of the other classes (except those of c1) in the pkgA? Could it be because their retained memory is insignificant?

Thanks.
Post Reply