我的服务器在CentOS 6.7上使用1.8.0_92,GC参数是'-Xms16g -Xmx16g -XX:+ UseG1GC'.所以默认的InitiatingHeapOccupancyPercent是45,G1HeapWastePercent是5,而G1MixedGCLiveThresholdPercent是85.我的服务器的混合GC从7.2GB开始,但它越来越少,最后老一代保持大于7.2GB,所以它总是尝试做并发标记.最后所有堆都耗尽并且发生了完整的GC.完全GC后,使用的旧版本低于500MB.
我很好奇为什么我的混合GC不能收集更多,看起来像实时数据不是那么多......
我曾尝试打印g1相关信息,并发现许多消息如下,看起来我的旧版包含很多实时数据,但为什么完整的GC可以收集这么多......
G1Ergonomics (Mixed GCs) do not continue mixed GCs, reason: reclaimable percentage not over threshold, candidate old regions: 190 regions, reclaimable: 856223240 bytes (4.98 %), threshold: 5.00 %
Run Code Online (Sandbox Code Playgroud)
以下日志是将InitiatingHeapOccupancyPercent修改为15(启动并发标记为2.4GB)以加快速度的结果.
### PHASE Post-Marking
......
### SUMMARY capacity: 16384.00 MB used: 2918.42 MB / 17.81 % prev-live: 2407.92 MB / 14.70 % next-live: 2395.00 MB / 14.62 % remset: 56.66 MB code-roots: 0.91 MB
### PHASE Post-Sorting
....
### SUMMARY capacity: 1624.00 MB used: 1624.00 MB …Run Code Online (Sandbox Code Playgroud) 我想OnScrollListener#onScrollStateChanged(SCROLL_STATE_IDLE)在滚动停止后做一些事情.所以,我尝试使用来检测滚动停止的时间(或者TOUCH_SCROLL or FLING)(在1.5时它按预期运行).但是当它在2.0上运行时,onScrollStateChanged在释放finger之后无法接收到该事件.是否有任何回调或者无论如何都要检测到该事件?