Question about the return value of g1CollectedHeap::expand()
Thomas Schatzl
thomas.schatzl at oracle.com
Mon Oct 11 21:20:38 UTC 2021
Hi Jonathan,
you are right afaict. The correct return value should be "return expanded_by > 0;" as you suggest.
I filed https://bugs.openjdk.java.net/browse/JDK-8275080. Feel free to pick it up! 🙂
Thanks,
Thomas
________________________________
From: hotspot-gc-dev <hotspot-gc-dev-retn at openjdk.java.net> on behalf of Jonathan Joo <jonathanjoo at google.com>
Sent: Monday, October 11, 2021 10:33 PM
To: hotspot-gc-dev <hotspot-gc-dev at openjdk.java.net>
Subject: Question about the return value of g1CollectedHeap::expand()
Hello,
I'm not sure if this is a bug, but in the documentation it says that
expand() returns True if the heap was expanded by the requested amount:
https://github.com/openjdk/jdk17/blob/master/src/hotspot/share/gc/g1/g1CollectedHeap.hpp#L592
However, in the code, it seems to actually return True if the number of
regions to expand is > 0, which is not dependent on whether the expand()
call actually expands the heap or not.
https://github.com/openjdk/jdk17/blob/master/src/hotspot/share/gc/g1/g1CollectedHeap.cpp#L1318
I believe the return value should be something like `return
expanded_by > 0` (if
any heap expansion should return True), or even `return expanded_by ==
regions_to_expand` (if the full requested expansion needs to occur in order
to return True).
Am I misunderstanding something here? Thank you in advance!
~ Jonathan
More information about the hotspot-gc-dev
mailing list