Question about the return value of g1CollectedHeap::expand()
Jonathan Joo
jonathanjoo at google.com
Mon Oct 11 20:33:48 UTC 2021
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