You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I find when the Class contains more than 150 fields, and use MethodAccess.invoke to run the method, it would take a lot of physical memory, those memory is outside the heap and it cannot be tracked in java NMT. This will cause the docker or k8s oom kill.
@RunWith(JUnit4.class)
@Slf4jpublicclassTestDomainMethodAccess {
@Testpublicvoidtest() throwsException{
OperatingSystemMXBeanosmxb = (OperatingSystemMXBean)ManagementFactory.getOperatingSystemMXBean();
MethodAccessmethodAccess = ReflectionUtil.getMethodAccess(TestDomain.class);
for (inti = 0; i < 1000; i++) {
TestDomainsource = newTestDomain();
for (intj = 0; j < 180; j++) {
methodAccess.invoke(source, "getField" + (j + 1), newObject[0]);
}
Thread.sleep(100);
System.out.println(""+ StringUtils.rightPad(""+(i+1),3)+"Call," +
"Free OS Mem "+StringUtils.leftPad(""+osmxb.getFreePhysicalMemorySize()/1024/1024,6)+"MB"+
", JVM Mem "+StringUtils.leftPad(""+Runtime.getRuntime().totalMemory()/1024/1024,6)+"MB");
}
}
}
the result
Connected to the target VM, address: '127.0.0.1:53946', transport: 'socket'
1 Call,Free OS Mem 2114MB, JVM Mem 123MB
2 Call,Free OS Mem 2113MB, JVM Mem 123MB
3 Call,Free OS Mem 2101MB, JVM Mem 123MB
4 Call,Free OS Mem 2082MB, JVM Mem 123MB
5 Call,Free OS Mem 2081MB, JVM Mem 123MB
6 Call,Free OS Mem 2081MB, JVM Mem 123MB
7 Call,Free OS Mem 2081MB, JVM Mem 123MB
8 Call,Free OS Mem 2081MB, JVM Mem 123MB
9 Call,Free OS Mem 2081MB, JVM Mem 123MB
10 Call,Free OS Mem 2081MB, JVM Mem 123MB
11 Call,Free OS Mem 2081MB, JVM Mem 123MB
12 Call,Free OS Mem 2080MB, JVM Mem 123MB
13 Call,Free OS Mem 2080MB, JVM Mem 123MB
14 Call,Free OS Mem 2108MB, JVM Mem 123MB
15 Call,Free OS Mem 2108MB, JVM Mem 123MB
16 Call,Free OS Mem 2108MB, JVM Mem 123MB
17 Call,Free OS Mem 2108MB, JVM Mem 123MB
18 Call,Free OS Mem 2108MB, JVM Mem 123MB
19 Call,Free OS Mem 2108MB, JVM Mem 123MB
20 Call,Free OS Mem 2108MB, JVM Mem 123MB
21 Call,Free OS Mem 2121MB, JVM Mem 123MB
22 Call,Free OS Mem 2121MB, JVM Mem 123MB
23 Call,Free OS Mem 2121MB, JVM Mem 123MB
24 Call,Free OS Mem 2121MB, JVM Mem 123MB
25 Call,Free OS Mem 2121MB, JVM Mem 123MB
26 Call,Free OS Mem 2121MB, JVM Mem 123MB
27 Call,Free OS Mem 2121MB, JVM Mem 123MB
28 Call,Free OS Mem 2121MB, JVM Mem 123MB
29 Call,Free OS Mem 2121MB, JVM Mem 123MB
30 Call,Free OS Mem 2121MB, JVM Mem 123MB
31 Call,Free OS Mem 2121MB, JVM Mem 123MB
32 Call,Free OS Mem 2111MB, JVM Mem 123MB
33 Call,Free OS Mem 2112MB, JVM Mem 123MB
34 Call,Free OS Mem 2112MB, JVM Mem 123MB
35 Call,Free OS Mem 2112MB, JVM Mem 123MB
36 Call,Free OS Mem 2112MB, JVM Mem 123MB
37 Call,Free OS Mem 2112MB, JVM Mem 123MB
38 Call,Free OS Mem 2112MB, JVM Mem 123MB
39 Call,Free OS Mem 2112MB, JVM Mem 123MB
40 Call,Free OS Mem 2112MB, JVM Mem 123MB
41 Call,Free OS Mem 1845MB, JVM Mem 123MB
42 Call,Free OS Mem 1821MB, JVM Mem 123MB
43 Call,Free OS Mem 1788MB, JVM Mem 123MB
44 Call,Free OS Mem 2010MB, JVM Mem 123MB
45 Call,Free OS Mem 2010MB, JVM Mem 123MB
46 Call,Free OS Mem 2010MB, JVM Mem 123MB
47 Call,Free OS Mem 2010MB, JVM Mem 123MB
48 Call,Free OS Mem 2010MB, JVM Mem 123MB
49 Call,Free OS Mem 2010MB, JVM Mem 123MB
50 Call,Free OS Mem 2010MB, JVM Mem 123MB
51 Call,Free OS Mem 1509MB, JVM Mem 123MB
52 Call,Free OS Mem 1420MB, JVM Mem 123MB
53 Call,Free OS Mem 1318MB, JVM Mem 123MB
54 Call,Free OS Mem 1221MB, JVM Mem 123MB
55 Call,Free OS Mem 1124MB, JVM Mem 123MB
56 Call,Free OS Mem 1026MB, JVM Mem 123MB
57 Call,Free OS Mem 1026MB, JVM Mem 123MB
58 Call,Free OS Mem 1026MB, JVM Mem 123MB
59 Call,Free OS Mem 1026MB, JVM Mem 123MB
60 Call,Free OS Mem 1026MB, JVM Mem 123MB
61 Call,Free OS Mem 550MB, JVM Mem 123MB
62 Call,Free OS Mem 462MB, JVM Mem 123MB
63 Call,Free OS Mem 367MB, JVM Mem 123MB
64 Call,Free OS Mem 282MB, JVM Mem 123MB
65 Call,Free OS Mem 185MB, JVM Mem 123MB
66 Call,Free OS Mem 92MB, JVM Mem 123MB
67 Call,Free OS Mem 15MB, JVM Mem 123MB
68 Call,Free OS Mem 15MB, JVM Mem 123MB
69 Call,Free OS Mem 15MB, JVM Mem 123MB
70 Call,Free OS Mem 15MB, JVM Mem 123MB
71 Call,Free OS Mem 624MB, JVM Mem 123MB
72 Call,Free OS Mem 1586MB, JVM Mem 123MB
73 Call,Free OS Mem 1586MB, JVM Mem 123MB
74 Call,Free OS Mem 1586MB, JVM Mem 123MB
75 Call,Free OS Mem 1586MB, JVM Mem 123MB
76 Call,Free OS Mem 1586MB, JVM Mem 123MB
77 Call,Free OS Mem 1586MB, JVM Mem 123MB
78 Call,Free OS Mem 1586MB, JVM Mem 123MB
79 Call,Free OS Mem 1586MB, JVM Mem 123MB
80 Call,Free OS Mem 1586MB, JVM Mem 123MB
81 Call,Free OS Mem 2151MB, JVM Mem 123MB
82 Call,Free OS Mem 2165MB, JVM Mem 123MB
83 Call,Free OS Mem 2164MB, JVM Mem 123MB
84 Call,Free OS Mem 2163MB, JVM Mem 123MB
85 Call,Free OS Mem 2162MB, JVM Mem 123MB
86 Call,Free OS Mem 2162MB, JVM Mem 123MB
87 Call,Free OS Mem 2162MB, JVM Mem 123MB
88 Call,Free OS Mem 2162MB, JVM Mem 123MB
89 Call,Free OS Mem 2162MB, JVM Mem 123MB
90 Call,Free OS Mem 2162MB, JVM Mem 123MB
91 Call,Free OS Mem 2158MB, JVM Mem 123MB
92 Call,Free OS Mem 2158MB, JVM Mem 123MB
93 Call,Free OS Mem 2158MB, JVM Mem 123MB
94 Call,Free OS Mem 2154MB, JVM Mem 123MB
95 Call,Free OS Mem 2161MB, JVM Mem 123MB
96 Call,Free OS Mem 2161MB, JVM Mem 123MB
97 Call,Free OS Mem 2161MB, JVM Mem 123MB
98 Call,Free OS Mem 2161MB, JVM Mem 123MB
99 Call,Free OS Mem 2161MB, JVM Mem 123MB
100Call,Free OS Mem 2161MB, JVM Mem 123MB
Disconnected from the target VM, address: '127.0.0.1:53946', transport: 'socket'
Process finished with exit code 0
The text was updated successfully, but these errors were encountered:
I find when the Class contains more than 150 fields, and use MethodAccess.invoke to run the method, it would take a lot of physical memory, those memory is outside the heap and it cannot be tracked in java NMT. This will cause the docker or k8s oom kill.
Under jdk1.8.0_201, CentOS 7
the result
The text was updated successfully, but these errors were encountered: