fork(3) download
  1. import java.lang.management.GarbageCollectorMXBean;
  2. import java.lang.management.ManagementFactory;
  3. import java.lang.management.MemoryUsage;
  4. import java.util.List;
  5. import java.util.Map;
  6.  
  7. import javax.management.NotificationEmitter;
  8. import javax.management.openmbean.CompositeData;
  9.  
  10. import com.sun.management.GarbageCollectionNotificationInfo;
  11. import com.sun.management.GcInfo;
  12.  
  13. class Tmp
  14. {
  15. static volatile Object PREVENT_ESCAPE_ANALYSIS;
  16.  
  17. public static void main(String[] args)
  18. {
  19. List<GarbageCollectorMXBean> gc = ManagementFactory.getGarbageCollectorMXBeans();
  20. for(GarbageCollectorMXBean b: gc) {
  21. ((NotificationEmitter)b).addNotificationListener((n, handback) -> {
  22. GarbageCollectionNotificationInfo gcni = GarbageCollectionNotificationInfo.from((CompositeData)n.getUserData());
  23. GcInfo info = gcni.getGcInfo();
  24. System.out.printf("%tT.%1$tL %dms %s %s %s%n", info.getStartTime(), info.getDuration(), gcni.getGcName(), gcni.getGcAction(), gcni.getGcCause());
  25. Map<String, MemoryUsage> before = info.getMemoryUsageBeforeGc();
  26. info.getMemoryUsageAfterGc().forEach((s, u) -> {
  27. long bu = before.get(s).getUsed(), au = u.getUsed();
  28. if(bu != au) System.out.println("\t" + s + " " + bu + " -> " + au);
  29. });
  30. }, null, b);
  31. }
  32.  
  33. for(;;) {
  34. PREVENT_ESCAPE_ANALYSIS = new Object();
  35. }
  36. }
  37. }
  38.  
Time limit exceeded #stdin #stdout 5s 134688KB
stdin
Standard input is empty
stdout
00:00:00.203 2ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
	Survivor Space 0 -> 795176
00:00:00.271 1ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
	Survivor Space 795176 -> 862960
00:00:00.355 2ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
	Survivor Space 862960 -> 931952
00:00:00.412 2ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
	Survivor Space 931952 -> 1004784
00:00:00.497 2ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
	Survivor Space 1004784 -> 1379400
00:00:00.574 3ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
	Survivor Space 1379400 -> 1551944
00:00:00.632 2ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
	Survivor Space 1551944 -> 1541144
00:00:00.676 2ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
	Survivor Space 1541144 -> 1541264
00:00:00.725 2ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:00.766 2ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:00.809 2ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
	Survivor Space 1541264 -> 1541392
00:00:00.851 2ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:00.895 1ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
	Survivor Space 1541392 -> 1541680
00:00:00.942 1ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:00.984 2ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
	Survivor Space 1541680 -> 1541744
00:00:01.027 3ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
	Survivor Space 1541744 -> 754664
	Tenured Gen 0 -> 787080
00:00:01.081 1ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
	Survivor Space 754664 -> 685224
	Tenured Gen 787080 -> 856752
00:00:01.127 1ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
	Survivor Space 685224 -> 627576
	Tenured Gen 856752 -> 914400
00:00:01.166 1ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
	Survivor Space 627576 -> 568448
	Tenured Gen 914400 -> 973528
00:00:01.207 1ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
	Survivor Space 568448 -> 191104
	Tenured Gen 973528 -> 1350872
00:00:01.246 1ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
	Survivor Space 191104 -> 1000
	Tenured Gen 1350872 -> 1540976
00:00:01.285 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
	Survivor Space 1000 -> 848
	Tenured Gen 1540976 -> 1541128
00:00:01.324 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
	Survivor Space 848 -> 728
	Tenured Gen 1541128 -> 1541248
00:00:01.363 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:01.408 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
	Survivor Space 728 -> 904
00:00:01.449 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
	Survivor Space 904 -> 1032
	Tenured Gen 1541248 -> 1541376
00:00:01.489 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
	Survivor Space 1032 -> 1112
00:00:01.528 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
	Survivor Space 1112 -> 824
	Tenured Gen 1541376 -> 1541664
00:00:01.568 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:01.606 1ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
	Survivor Space 824 -> 760
	Tenured Gen 1541664 -> 1541728
00:00:01.647 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
	Survivor Space 760 -> 880
00:00:01.686 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
	Survivor Space 880 -> 648
	Tenured Gen 1541728 -> 1541960
00:00:01.729 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
	Survivor Space 648 -> 1152
00:00:01.768 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:01.806 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:01.845 1ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:01.884 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:01.927 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
	Survivor Space 1152 -> 1264
00:00:01.966 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:02.005 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
	Survivor Space 1264 -> 1088
	Tenured Gen 1541960 -> 1542136
00:00:02.044 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
	Survivor Space 1088 -> 832
	Tenured Gen 1542136 -> 1542392
00:00:02.082 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
	Survivor Space 832 -> 752
	Tenured Gen 1542392 -> 1542472
00:00:02.123 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:02.162 1ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:02.204 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:02.251 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
	Survivor Space 752 -> 1560
	Tenured Gen 1542472 -> 1542592
00:00:02.290 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:02.337 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
	Survivor Space 1560 -> 1256
	Tenured Gen 1542592 -> 1543096
00:00:02.378 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:02.418 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:02.468 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:02.508 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:02.553 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
	Survivor Space 1256 -> 1144
	Tenured Gen 1543096 -> 1543208
00:00:02.592 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:02.630 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:02.670 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:02.711 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
	Survivor Space 1144 -> 1192
00:00:02.752 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:02.790 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:02.828 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:02.867 1ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
	Survivor Space 1192 -> 264
	Tenured Gen 1543208 -> 1544136
00:00:02.906 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:02.947 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
	Survivor Space 264 -> 64
	Tenured Gen 1544136 -> 1544336
00:00:02.987 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:03.031 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
	Survivor Space 64 -> 136
00:00:03.070 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:03.108 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:03.147 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:03.185 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:03.223 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:03.261 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:03.299 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
	Survivor Space 136 -> 88
	Tenured Gen 1544336 -> 1544384
00:00:03.337 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:03.375 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:03.414 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:03.452 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:03.490 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:03.552 1ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
	Survivor Space 88 -> 1640
00:00:03.591 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:03.631 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
	Survivor Space 1640 -> 1568
	Tenured Gen 1544384 -> 1544456
00:00:03.670 1ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:03.709 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:03.750 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
	Survivor Space 1568 -> 1648
00:00:03.791 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:03.830 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:03.870 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:03.914 1ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:03.953 1ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:03.993 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:04.032 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:04.071 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:04.110 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:04.150 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
	Survivor Space 1648 -> 96
	Tenured Gen 1544456 -> 1546008
00:00:04.188 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:04.230 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
	Survivor Space 96 -> 1416
00:00:04.269 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:04.312 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:04.350 1ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
	Survivor Space 1416 -> 1336
	Tenured Gen 1546008 -> 1546088
00:00:04.388 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:04.427 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:04.465 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
	Survivor Space 1336 -> 1464
00:00:04.505 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
	Survivor Space 1464 -> 1512
00:00:04.544 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
	Survivor Space 1512 -> 1840
00:00:04.585 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
	Survivor Space 1840 -> 2832
00:00:04.622 1ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:04.660 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:04.698 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:04.736 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:04.774 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:04.812 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
	Survivor Space 2832 -> 1512
	Tenured Gen 1546088 -> 1547408
00:00:04.850 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:04.888 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:04.926 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:04.963 1ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:05.001 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
00:00:05.039 0ms Copy end of minor GC Allocation Failure
	Eden Space 70516736 -> 0
	Survivor Space 1512 -> 1384
	Tenured Gen 1547408 -> 1547536