Stop The World
2017-04-07 23:56
429 查看
import java.util.HashMap; /** * Created by wb-xxd249566 on 2017/4/5. * -Xmx1g -Xms1g -Xmn512k -XX:+UseSerialGC -Xloggc:gc.log -XX:+PrintGCDetails */ public class StopWorldTest { public static class MyThread extends Thread{ HashMap map = new HashMap(); @Override public void run() { try { while (true){ if (map.size()*512/1024/1024>=550){ map.clear(); System.out.println("clean map"); } byte[] b1; for (int i=0;i<100;i++){ b1 = new byte[512]; map.put(System.nanoTime(),b1); } Thread.sleep(1); } }catch (Exception e){ } } } public static class PrintThread extends Thread{ public static final long startTime = System.currentTimeMillis(); @Override public void run() { try { while (true){ long t = System.currentTimeMillis()-startTime; System.out.println(t/1000+"."+t%1000); Thread.sleep(100); } }catch (Exception e){ } } } public static void main(String[] args){ MyThread t = new MyThread(); PrintThread p = new PrintThread(); t.start(); p.start(); } }
相关文章推荐
- GC日志中的stop-the-world
- JVM进阶(八)——Stop The World
- [Java JVM] Hotspot GC研究- GC安全点 (Safepoint&Stop The World)
- 基于日志理解 cms 原理,为什么remark要stop the world?(理解CMS GC日志.)
- Java Safepoint 与Stop The World
- JVM进阶(八)——Stop The World
- Sapphire算法:GC Without Stop the World(上)
- JVM进阶(八)——Stop The World
- Stop the world
- JVM GC中Stop the world案例实战
- Stop The World(STW)
- JVM(8)之 Stop The World
- 1055. The World's Richest (25)
- UVA 1025 A Spy in the Metro - ACM/ICPC World Finals 2003
- The world of programming
- 浙江大学PAT_甲级_1055. The World's Richest (25)
- Exploring the world of Android
- Ganymede Around the world中我的名字
- Debug error:"One or more breakpoints cannot be set and have been disabled.Execution will stop at the
- Hello, JIT World: The Joy of Simple JITs