public static void test1(){
new Thread(() -> {
for (int i =0; i <100; i++) {
ThreadLocal threadLocal =new ThreadLocal<>();
threadLocal.set(new int[1014 *1024]);
System.out.println(threadLocal.get());
// threadLocal.remove();
}
}).start();
}
public static void test1(){
new Thread(() -> {
for (int i =0; i <100; i++) {
ThreadLocal threadLocal =new ThreadLocal<>();
threadLocal.set(new int[1014 *1024]);
System.out.println(threadLocal.get());
// threadLocal.remove();
}
}).start();
}
本文标题:ThreadLocal内存泄漏测试
本文链接:https://www.haomeiwen.com/subject/fvbdzhtx.html
网友评论