RFR: 7109087: gc/7072527/TestFullGCCount.java fails when GC is set in command-line

Kevin Walls kevin.walls at oracle.com
Wed Apr 17 15:53:53 UTC 2013


On 17/04/13 13:05, Mikael Gerdin wrote:
> Kevin,
>
> On 2013-04-10 16:05, Kevin Walls wrote:
>> Hi,
>>
>> I'd like a review of this testcase change.  It fails as it has a GC
>> option set in the jtreg tag which may conflict with what jtreg sends,
>> and fail to run.
>>
>> Although the test was created for a CMS problem, double-counting of full
>> collections, here it is adapted to check all collectors:
>>
>> http://cr.openjdk.java.net/~kevinw/7109087/webrev/
>
> Since you know the number of iterations I think it would be better to 
> use an ArrayList and use list.ensureCapacity(20) to avoid allocations 
> in addCollectionCount.
>
> You could also make the GarbageCollectorMXBean list available from a 
> static variable since I'm not sure what happens in that call path.
>
> Here you access theseCounts as a List instead of a List<Long>, maybe 
> the "counts" map should be a Map<String, List<Long>>?
>
> +            for (int i = 0; i < iterations - 1; i++) {
> +                List theseCounts = counts.get(collector);
> +                long a = (Long) theseCounts.get(i);
>
> /Mikael
>
>
>>
>> Thanks
>> Kevin


Hi Mikael, thanks -

ensureCapacity: not sure it stops the addCollectionCount() method 
changing/adding to the list?  We could verify the list is of the right 
length, although I don't think it's that important?...  
addCollectionCount adds one thing to the List for each collector each 
time it's called...  I don't think we can guarantee that collectors 
aren't getting invoked at any time, but we can make it unlikely, like 
the next point you make:

Yes, don't really need to call  into the ManagementFactory each 
iteration, and can reduce it to a single call to 
ManagementFactory.getGarbageCollectorMXBeans();  We don't need the 
List<MemoryPoolMXBean> at all.

Yes, those casts to Long can be eradicated.

Also there was an unused "count" variable in main(), removed it.. 8-)

And I should clone from hotspot-gc for this change.

New webrev: http://cr.openjdk.java.net/~kevinw/7109087/webrev.02/

Thanks
Kevin




More information about the hotspot-gc-dev mailing list