<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">
Hi,
<div><br>
</div>
<div>When you say that this causes ZGC to fail promotion. Do you mean that we do not select pages causing “memory leaks” because of fragmentation which larger than the ZYoungCompactionLimit? (And did you also mean old to old relocation selection?)</div>
<div><br>
</div>
<div>The selection code was taken from non-generational ZGC. So it also a bit inaccurate because it does not understand that promotions can only age the an object by one and we track age on a heap region basis. </div>
<div><br>
</div>
<div>I have a couple of branches where I worked on prototypes for improving this: <a href="https://github.com/openjdk/jdk/compare/master...xmas92:jdk:relocation_set_selection_cleanups">https://github.com/openjdk/jdk/compare/master...xmas92:jdk:relocation_set_selection_cleanups</a></div>
<div>(Which also aims to fixe the mismatch in the logs which you have observed.)</div>
<div><br>
</div>
<div>I was aware that our logic is fuzzy and that we have a mismatch in our logging. But I did not think we “failed to promote objects”. Maybe you can elaborate what you mean by this.</div>
<div><br>
</div>
<div>Thanks in advance,</div>
<div>Axel Boldt-Christmas</div>
<div><br id="lineBreakAtBeginningOfMessage">
<div><br>
<blockquote type="cite">
<div>On 9 Oct 2025, at 11:16, yifan zhang <yifanzhang765@gmail.com> wrote:</div>
<br class="Apple-interchange-newline">
<div>
<div dir="ltr">
<div class="gmail-mail-detail-subject" style="font-size: 14px; font-family: -apple-system, BlinkMacSystemFont, system-ui, "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", "Source Han Sans CN", "Noto Sans CJK SC", sans-serif;">
<span style="font-family:monospace;white-space:pre">Hi ZGC Developers,</span></div>
<div class="gmail-mail-detail-content" style="font-size:14px;color:rgb(19,24,29);line-height:1.43;word-break:normal;min-height:100px;padding:20px 0px;box-sizing:border-box;overflow:auto hidden;font-family:-apple-system,BlinkMacSystemFont,system-ui,"PingFang SC","Microsoft YaHei UI","Microsoft YaHei","Source Han Sans CN","Noto Sans CJK SC",sans-serif">
<div class="gmail-qmbox" style="min-height:526px">
<pre style="margin:0px;line-height:1.43"><div style="margin: 0px; line-height: 1.43;"><span style="">I've encountered an issue where ZGC might fail to promote objects under a specific condition, leading to a memory leak. This patch aims to fix it.
* Problem:
The number of selected pages in the ZGC log is incorrect.
* Fix:
The root cause lies in the execution of function ZRelocationSetSelectorGroup::select_inner, where the count of selected pages only includes the pages that satisfy the condition <code>diff_reclaimable > _fragmentation_limit</code>, while ignoring the previously accumulated pages. </span></div><div style="margin: 0px; line-height: 1.43;"><span style=""> This results in a mismatch between the number of pages actually reclaimed during relocation and the count reflected in the log.</span></div><div style="margin: 0px; line-height: 1.43;"><span style=""> I have attached my modifications in the attachment.
* Testing:
I've tested this fix by jtreg.</span></div><p style="margin:0px;line-height:1.43"><span style="">
</span></p><div style="margin: 0px; line-height: 1.43;"><span style="">I would like to ask ZGC developers to review whether this can be created as an issue. Once it is created, how should I commit my modifications for it? Furthermore, how can I become an OpenJDK author?
Please help to review this patch. Any feedback is appreciated.
Thanks,
</span></div><div style="line-height: 1.43;">Yifan Zhang</div></pre>
</div>
</div>
</div>
<span id="cid:f_mgj7e89f0"><zgc_fix.patch></span></div>
</blockquote>
</div>
<br>
</div>
</body>
</html>