Skip to content

Commit

Permalink
add a reflection memory test
Browse files Browse the repository at this point in the history
  • Loading branch information
guoyiteng committed Dec 18, 2019
1 parent 6f2f47c commit c96226a
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/isolated/ReflectionMemoryTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import java.lang.reflect.Field;
import java.lang.reflect.Method;

public class ReflectionMemoryTest {
static boolean b;

public static void main(String[] args) {
ReflectionMemoryTest s = new ReflectionMemoryTest();
Class cls = s.getClass();
Field[] fields = cls.getDeclaredFields();
Method[] methods = cls.getDeclaredMethods();
System.out.println(fields.length);
for (int i = 0; i < 100000; i++) {
System.out.println(fields[0].getType());
System.out.println(methods[0].getReturnType());
System.out.println(i);
}
}
}

0 comments on commit c96226a

Please sign in to comment.