cancel
Showing results for 
Search instead for 
Did you mean: 

How to interpret "Retained Heap" correctly?

Former Member
0 Kudos

Hi all,

I have difficulties to understand how "Retained Heap" is calculated in the 'outgoing references' view.

I have for example object

com.wuerth.phoenix.bcserver.base.versant.UpdateSession @ 0x7c780f00

for which SAP Memoryanalyzer shows a retained Heap of 77.392 bytes.

In the same view for 0x7c780f00 there is shown a outgoing (hard) reference to

com.versant.trans.TransSession @ 0x7c787d38

for which SAP Memoryanalyzer surprisingly shows a retained Heap of 191.096 bytes !

191.096 > 77.392 so it seems that SAP Memoryanalyzer

isn't considering all outgoing references when calculating the "Retained Heap" which is confusing me.

Any explanation is welcome

thanks

Guenther Demetz

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member197208
Participant
0 Kudos

Hi Guenther,

in your case, TransSession probably is also reference by other objects. So if the UpdateSession is garbage collected, the TransSession still stays around. And that's why the TransSession is not accounted to the retained heap of the UpdateSession.

Another example is a char array which is referenced by 2 strings. Both have outgoing references to the char array, but the size of the char array cannot be assigned to one of them.

Run "path 2 gc roots" on the TransSession who is keeping this object alive.

Andreas.

Former Member
0 Kudos

Hi Andreas,

>>in your case, TransSession probably is also reference by other objects.

Yes, in fact it is also referenced by a second object.

Thank you very much for the fast and clear answer!

best regards

Guenther