Community
Participate
Working Groups
When comparing two or more tables, the retained size is not compared, even if it has been calculated for the "source" tables. We need to find a way to improve this. The reason is that Retained Size is not part of the table definition, but rather a derived column which can be added to any table. The current implementation of the comparison features doesn't take this into account.
I think I know how to fix this one. The comparison needs to use the RefinedTable or RefinedTree. CompareBasketView needs to extract this from ResultPane using getAdapter and the panes (QueryResultPane) needs to supply it if requested. Perhaps getAdapter for IResultTable should still return the original unrefined table even though RefinedTable also implements that. The comparison will also then use the filtered version of the tables, which I hope won't be a problem and might be useful, it just needs to be documented. There was a slight bug with Merge Paths from GC Roots by Class as the precalculated retained sizes were not used. This is because the cached version was not found as getElements() returned different but equivalent rows each times, but equals and hashCode had the rows as different.
There is a slight problem with retained sizes. These can be approximate or precise, depending on the method of calculation. Internally approximate sizes are stored as negative, and displayed as >=value. So: Class Name | Objects #1 | Objects #2 | Shallow Heap #1 | Shallow Heap #2 | Retained Heap #1 | Retained Heap #2 ---------------------------------------------------------------------------------------------------------------------------------------- | | | | | | byte[] | 3,603 | 552,515 | 30,248,168 | 588,956,544 | 30,248,168 | >= 588,956,544 char[] | 122,615 | 1,532,892 | 10,622,368 | 99,591,896 | >= 10,622,368 | 99,591,896 org.eclipse.mat.snapshot.model.Field| 209,215 | 429,687 | 5,021,160 | 10,312,488 | >= 9,540,248 | >= 30,759,816 ---------------------------------------------------------------------------------------------------------------------------------------- is a table with approximate values in different columns. As a difference: Class Name | Objects #1 | Objects #2-#1 | Shallow Heap #1 | Shallow Heap #2-#1 | Retained Heap #1 | Retained Heap #2-#1 ------------------------------------------------------------------------------------------------------------------------------------------------- byte[] | 3,603 | +548,912 | 30,248,168 | +558,708,376 | 30,248,168 | -619,204,712 char[] | 122,615 | +1,410,277 | 10,622,368 | +88,969,528 | >= 10,622,368 | +110,214,264 org.eclipse.mat.snapshot.model.Field| 209,215 | +220,472 | 5,021,160 | +5,291,328 | >= 9,540,248 | -21,219,568 ------------------------------------------------------------------------------------------------------------------------------------------------- so the differences are byte[] 30,248,168 >=588,956,544 : -588,956,544 - 30,248,168 = -619,204,712 char[] >=10,622,368 99,591,896 : 99,591,896 - -10,622,368 = +110,214,264 org.eclipse.mat.snapshot.model.Field >= 9,540,248 >= 30,759,816 : -30,759,816 - -9,540,248 = -21,219,568 Actually for byte[] it should be >=+558,708,376 char[] <= 88,969,528 org.eclipse.mat.snapshot.model.Field >= 21,219,568 Converting and displaying this is going to be complicated as values can be exact, or approximate above or below a positive or negative figure. These figures could then be used for another table comparison which adds to the complication.
The display figures can also be indeterminate, for subtracting two figures >=. I have a solution which involves encoding the size delta. This is already done for retained sizes which can be exact or approximate (>=value). A negative size means >= which is used by the formatter and converted to an ordinary number by a Filter.ValueConverter for filtering (and should be for sorting, though the retained size has a special comparator. Now we have 4 states, exact, >=value, <=value and uncertain: ~value and we can choose ranges of long to represent each one. The exact >= and <= ranges should be small enough for exact conversions to and from double for the value converter. The table result would now look like this: Class Name | Objects #1 | Objects #2-#1 | Shallow Heap #1 | Shallow Heap #2-#1 | Retained Heap #1 | Retained Heap #2-#1 ------------------------------------------------------------------------------------------------------------------------------------------------- byte[] | 3,603 | +548,912 | 30,248,168 | +558,708,376 | 30,248,168 | ≥ +558,708,376 char[] | 122,615 | +1,410,277 | 10,622,368 | +88,969,528 | >= 10,622,368 | ≤ +88,969,528 org.eclipse.mat.snapshot.model.Field| 209,215 | +220,472 | 5,021,160 | +5,291,328 | >= 9,540,248 | ≈ +21,219,568 ------------------------------------------------------------------------------------------------------------------------------------------------- Note the last column.
New Gerrit change created: https://git.eclipse.org/r/159461
Gerrit change https://git.eclipse.org/r/159461 was merged to [master]. Commit: http://git.eclipse.org/c/mat/org.eclipse.mat.git/commit/?id=f365de1e6dc1dd7f42e98d6b6b628d6416f3acf2
I have merged some changes to fix this. Comments welcome.
New Gerrit change created: https://git.eclipse.org/r/160767
Gerrit change https://git.eclipse.org/r/160767 was merged to [master]. Commit: http://git.eclipse.org/c/mat/org.eclipse.mat.git/commit/?id=08a8e7f50a102a27db22f34b1e7d54e42169ced1
This is now fixed (please reopen if not).