Skip to content

Commit 39f0b27

Browse files
jyukutyoYaSuenag
authored andcommitted
8176026: SA: Huge heap sizes cause a negative value to be displayed in the jhisto heap total
Reviewed-by: cjplummer, kevinw, ysuenaga
1 parent de495df commit 39f0b27

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ObjectHistogram.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -65,8 +65,8 @@ public void printOn(PrintStream tty) {
6565
ObjectHistogramElement.titleOn(tty);
6666
Iterator<ObjectHistogramElement> iterator = list.listIterator();
6767
int num=0;
68-
int totalCount=0;
69-
int totalSize=0;
68+
long totalCount=0;
69+
long totalSize=0;
7070
while (iterator.hasNext()) {
7171
ObjectHistogramElement el = iterator.next();
7272
num++;

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ObjectHistogramElement.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -47,7 +47,7 @@ public void updateWith(Oop obj) {
4747
}
4848

4949
public int compare(ObjectHistogramElement other) {
50-
return (int) (other.size - size);
50+
return Long.compare(other.size, size);
5151
}
5252

5353
/** Klass for this ObjectHistogramElement */

0 commit comments

Comments
 (0)