RFR: 8310428: Add CollectedHeap::reserved_range() API to return reserved heap memory range

Thomas Stuefe stuefe at openjdk.org
Tue Jun 27 09:24:06 UTC 2023


On Wed, 21 Jun 2023 15:30:17 GMT, Ashutosh Mehra <duke at openjdk.org> wrote:

> Please review this patch to add a new API `CollectedHeap::reserved_range()`. The changes are extracted out from https://github.com/openjdk/jdk/pull/14520 as per the suggestion [here](https://github.com/openjdk/jdk/pull/14520#discussion_r1234991165). Support for ZGC is not implemented yet as it can have discontiguous heap regions and unlike other collectors, it does not set `CollectedHeap::_reserved`.

> > Such an API would not need to know anything about the
> > heap but would benefit from knowing large reserved areas _like_ the heap to
> > prevent unnecessary work.
> 
> How about the api returning array of MemRange to handle discontiguous heap layouts? @tstuefe would that work for your case? @stefank is that possible to do with ZGC?

Hi @ashu-mehra, I'm afraid not. For collectors that maintain disjunct regions this could be costly (they would have to collect all ranges and return it in a data structure), while it is not clear the caller even needs it.

I'm not sure I can contribute much more here; sorry for causing you that work. I'll wait for Oracle's decision.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/14595#issuecomment-1609118493


More information about the hotspot-dev mailing list