jhat's OQL (Object Query Language) supports sum built-in function. This function returns sum of elements of the input array/iterator or enumeration. This function optionally accepts a code expression (second param) that is used to map the input elements before summing those.
For eg:
select sum(heap.objects('java.util.Vector'), 'sizeof(it)')
is supposed to print sum of sizes of all Vector instances.
But, this prints a String that is concatenation of individual sizes.
For eg:
select sum(heap.objects('java.util.Vector'), 'sizeof(it)')
is supposed to print sum of sizes of all Vector instances.
But, this prints a String that is concatenation of individual sizes.