On Wed, 10 Jun 2026 20:26:08 GMT, Chris Plummer <[email protected]> wrote:

> This is a test bug.  The gets the first region, gets top() for the that 
> region, and then uses that top() address to get the region that top() is in. 
> It expects it to be the same region. However, when the region is full, top() 
> is actually the next address beyond the end of the region, so marks the start 
> of the next region. The fix is to simply subtract 1 from top() when it equals 
> end(). Note top() is where the next allocation comes from in the region and 
> end() is the end of region space.
> 
> I improved the test by adding printing of the G1 heap, including all regions. 
> I also improved the test by making it test every region, not just the first 
> one. During local testing the first region was always free, so did not make 
> for a very good test, and would not reproduce the issue. When I started 
> testing every region, it failed every time. All you need is one full region 
> for failures.
> 
> I ran the test 100 times on all supported platforms.
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

This pull request has now been integrated.

Changeset: e965fcf2
Author:    Chris Plummer <[email protected]>
URL:       
https://git.openjdk.org/jdk/commit/e965fcf2c08851e443747fe4a47bfb96c15ab748
Stats:     38 lines in 1 file changed: 33 ins; 0 del; 5 mod

8386124: Test serviceability/sa/TestG1HeapRegion.java failed: Address of 
G1HeapRegion does not match

Reviewed-by: kevinw, ysuenaga

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

PR: https://git.openjdk.org/jdk/pull/31469

Reply via email to