Skip to content

Commit

Permalink
Merge pull request #33 from zakkak/2024-12-17-backport-6930
Browse files Browse the repository at this point in the history
[Backport] Exception on reading MemoryUsage
  • Loading branch information
zakkak authored Dec 18, 2024
2 parents 8dd038b + 30a0f13 commit a3b2323
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,14 @@

public abstract class AbstractMemoryPoolMXBean extends AbstractMXBean implements MemoryPoolMXBean {

protected static final UnsignedWord UNDEFINED = WordFactory.signed(UNDEFINED_MEMORY_USAGE);
private static final UnsignedWord UNINITIALIZED = WordFactory.zero();

private final String name;
private final String[] managerNames;
protected final UninterruptibleUtils.AtomicUnsigned peakUsage = new UninterruptibleUtils.AtomicUnsigned();

private static final UnsignedWord UNDEFINED = WordFactory.zero();
protected UnsignedWord initialValue = UNDEFINED;
protected UnsignedWord initialValue = UNINITIALIZED;

@Platforms(Platform.HOSTED_ONLY.class)
protected AbstractMemoryPoolMXBean(String name, String... managerNames) {
Expand All @@ -60,7 +62,7 @@ protected AbstractMemoryPoolMXBean(String name, String... managerNames) {
}

UnsignedWord getInitialValue() {
if (initialValue.equal(UNDEFINED)) {
if (initialValue.equal(UNINITIALIZED)) {
initialValue = computeInitialValue();
}
return initialValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ UnsignedWord computeInitialValue() {

@Override
UnsignedWord getMaximumValue() {
return GCImpl.getPolicy().getMaximumEdenSize();
return UNDEFINED;
}

@Override
Expand Down Expand Up @@ -150,7 +150,7 @@ UnsignedWord computeInitialValue() {

@Override
UnsignedWord getMaximumValue() {
return GCImpl.getPolicy().getMaximumSurvivorSize();
return UNDEFINED;
}

@Override
Expand Down Expand Up @@ -193,7 +193,7 @@ UnsignedWord computeInitialValue() {

@Override
UnsignedWord getMaximumValue() {
return GCImpl.getPolicy().getMaximumOldSize();
return UNDEFINED;
}

@Override
Expand Down Expand Up @@ -236,7 +236,7 @@ UnsignedWord computeInitialValue() {

@Override
UnsignedWord getMaximumValue() {
return GCImpl.getPolicy().getMaximumHeapSize();
return UNDEFINED;
}

@Override
Expand Down

0 comments on commit a3b2323

Please sign in to comment.