8176026: SA: Huge heap sizes cause a negative value to be displayed in the jhisto heap total

Reviewed-by: cjplummer, kevinw, ysuenaga
This commit is contained in:
Koichi Sakata 2021-04-01 04:10:15 +00:00 committed by Yasumasa Suenaga
parent de495df78d
commit 39f0b27a12
2 changed files with 5 additions and 5 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -65,8 +65,8 @@ public class ObjectHistogram implements HeapVisitor {
ObjectHistogramElement.titleOn(tty);
Iterator<ObjectHistogramElement> iterator = list.listIterator();
int num=0;
int totalCount=0;
int totalSize=0;
long totalCount=0;
long totalSize=0;
while (iterator.hasNext()) {
ObjectHistogramElement el = iterator.next();
num++;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -47,7 +47,7 @@ public class ObjectHistogramElement {
}
public int compare(ObjectHistogramElement other) {
return (int) (other.size - size);
return Long.compare(other.size, size);
}
/** Klass for this ObjectHistogramElement */