Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate Z GC #24

Open
johnshajiang opened this issue Jun 26, 2024 · 6 comments
Open

Investigate Z GC #24

johnshajiang opened this issue Jun 26, 2024 · 6 comments

Comments

@johnshajiang
Copy link
Collaborator

johnshajiang commented Jun 26, 2024

针对Z GC,编写程序模拟内存分配与垃圾回收场景,能够反应出该GC的特点。解释它的GC日志。修改程序或JVM参数以达成特定目标,如较高的吞吐量。

最终输出一份报告。
报告请放在自己的GitHub中,并将报告的链接通过邮件发送给我们。
在发邮件时,请在标题的开头处注明[姓名+GitHubID+IssueID]
例如,[江莎+johnshajiang+25]


本issue为2024犀牛鸟开源人才培养活动专属issue,仅供在校大学生参与领取
【认领issue】在研学基地"issue营地"对应issue行的M~R列抢滩报名,即视为认领成功
【完成issue】已认领issue的同学,请同步在本issue评论区回复“已成功领取本issue”; 如7天内无提交任何进展包括不限于comment \ commit \ Pull Request,则将视为同学主动放弃issue,组委会将释放issue给下一位等候者。

@seven17777777
Copy link

已成功领取本issue

@seven17777777
Copy link

java版本corretto21
java程序

public class ZGCDemo {
    public static void main(String[] args) {
        List<byte[]> memoryHog = new ArrayList<>();
        int k = 1;
        while (true) {
            for (int i = 0; i < 1000; i++) {
                // 分配1MB的数组
                byte[] array = new byte[1024 * 1024];
                memoryHog.add(array);
            }
            System.out.println("第" + k++ + "分配1M内存" + "List 大小:" + memoryHog.size());
            // 模拟内存使用情况
            if (memoryHog.size() > 1000) {
                memoryHog.subList(0, 500).clear();
            }

            try {
                // 暂停一段时间,模拟应用程序的其他工作
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}

使用指令

-XX:+UseZGC
-Xlog:gc*:file=gc.log

部分日志文件
image

@johnshajiang
Copy link
Collaborator Author

在发邮件时,请在标题的开头处注明[姓名+GitHubID+IssueID]
例如,[江莎+johnshajiang+25]

@yetianlong
Copy link

已成功领取本issue

2 similar comments
@yubowei123
Copy link

已成功领取本issue

@finalMatsuri
Copy link

已成功领取本issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants