Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mat-dev] Reworked collection extraction API

> From: James Livingston <jlivings@xxxxxxxxxx>
> Hi,
> 
> Sorry I've been a bit quiet about the Java EE queries recently, I got
> snowed until with normal work. I've gotten back to extracting a usable
> API for dealing with collections in heap dumps, which may be more
> suitable to being made public (so can be used by my EE plugins).
>
That sounds quite a good idea - the difficulty was that the snapshot API
is fairly general, so should apply to most VMs, but class library 
internals
varied from VM to VM and between versions,so making an API that works for
all VMs is harder, and making one which is extensible by adopters for new
VMs a bit harder still. Some of the collection classes have complex
internals and I couldn't get quite all them all to work. Getting them to
work for IBM Portable Heap Dump files which don't have field names
is near impossible for some collections.
If the Java EE queries were part of MAT in the API project then they could
use internal interfaces before the interfaces were fully standardized.
One question is how wrapped collections should be reported. Both the
inside collection and the wrapper could be flagged, but fixing the problem
only saves one lot of space.
>
> I've ported by my EE queries and the standard collection queries over to
> it (re-using as much existing implementation code as possible). I'm
> currently running through the test suite to fix all the thing I've
> broken. I'll post it for comment soon.
> 
> 
> I'm not very familiar with Tycho's surefire runner, is there a way to
> run a single test, or even better do so from within Eclipse? So far I
> just have Eclipse invoking Tycho's test runner which means I have to
> re-run the whole suite just to test a single fix.
>
Yes, you can run them from inside of Eclipse. See this, and if it isn't 
clear then we should edit the wiki.
http://wiki.eclipse.org/index.php?title=MemoryAnalyzer/Contributor_Reference#JUnit_Tests

> 
> While testing, I've also noticed some inconsistencies in how the
> existing code behaves for various collections. For example the fill
> ratio of a zero-length array and zero-length list are not the same (0.0
> vs 1.0). Is it important to keep the current behaviour for things like
> that?
> 
The main reason for behaviour fill ratio zero-length objects is whether
it should generate a finding in the component report etc. They are both
full and empty! If the object is unresizable then generating a warning
might make sense as a singleton could be used instead, but if it
can grow then a zero sized collection might be needed and not be a
problem.

The real warning should be in bytes of wasted space per collection rather
than a percentage, but we don't currently calculate that.
> -- 
> James "Doc" Livingston
> JBoss Support Engineering Group
> Red Hat
> 
Andrew Johnson

Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 
741598. 
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU



Back to the top