Skip to content

Commit c96226a

Browse files
committed
add a reflection memory test
1 parent 6f2f47c commit c96226a

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import java.lang.reflect.Field;
2+
import java.lang.reflect.Method;
3+
4+
public class ReflectionMemoryTest {
5+
static boolean b;
6+
7+
public static void main(String[] args) {
8+
ReflectionMemoryTest s = new ReflectionMemoryTest();
9+
Class cls = s.getClass();
10+
Field[] fields = cls.getDeclaredFields();
11+
Method[] methods = cls.getDeclaredMethods();
12+
System.out.println(fields.length);
13+
for (int i = 0; i < 100000; i++) {
14+
System.out.println(fields[0].getType());
15+
System.out.println(methods[0].getReturnType());
16+
System.out.println(i);
17+
}
18+
}
19+
}

0 commit comments

Comments
 (0)