Skip to content

Commit 10720a3

Browse files
committed
verify glibc ptmalloc arena
1 parent b9b0cd6 commit 10720a3

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

class/src/main/java/jvm/oom/DirectMemoryGlibcGrow.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public static void loopFragment() throws InterruptedException {
4646
Runnable run = () -> {
4747
try {
4848
for (int i = 0; i < 1000; i++) {
49-
TimeUnit.SECONDS.sleep(3);
49+
TimeUnit.MILLISECONDS.sleep(2000 + ThreadLocalRandom.current().nextInt(1000));
5050
fragment();
5151
System.out.println("loop " + i);
5252
}

class/src/test/java/jvm/oom/DirectMemoryGlibcGrowTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ public void testFragment() throws Exception {
1616

1717
/**
1818
* pmap -x 259296 | jvm-tool -s 查看块数量
19+
* 注意,IDE启动,则是使用全部的核心,最大thread arena数量是 cpu核数*8
20+
* 可复制IDE第一行命令,创建shell脚本,删除-agentlib:jdwp的参数,命令前添加 taskset -c 0,1 来限制CPU核心数,可以看到数量就变成17了 1+8*2, 1是 main arena
1921
*/
2022
@Test
2123
public void testLoopFragment() throws Exception {

0 commit comments

Comments
 (0)