elicpse里面catalina.log目录properties怎么配置gc.log

优化JVM参数提高eclipse运行速度._百度文库
两大类热门资源免费畅读
续费一年阅读会员,立省24元!
优化JVM参数提高eclipse运行速度.
&&eclipse 打开及运行速度提升
阅读已结束,下载文档到电脑
想免费下载更多文档?
定制HR最喜欢的简历
你可能喜欢Darker and Better Dark Theme on All Platforms
Eclipse looks better in dark than ever with all the improvements that have been made this year. All platforms have seen improvements, and among others, table headers and popup now looks way darker than before.
Debug Faster with the Java Development Tool
The return value of the last method call is always displayed in the variable view when you debug some Java code. No more need to create temporary variable to find and eradicate sneaky bugs!
Test Code and Manage Dependencies with PHP Development Tools
The PHP support in Eclipse improved by adding integration with PHPUnit for testing PHP code, and with Composer for managing PHP dependencies.
Join the Virtual Eclipse Community MeetUp (vECM). Learn from the experts and
discover what's new in the Eclipse Oxygen Release Train (June 28). Register
today! It's free. #VirtualEclipse
EclEmma - Code Coverage in Practice
Marc R. Hoffmann
PHP Development Tools (PDT) 5.0
Kaloyan Raev
Eclipse Oxygen Series: New in Xtext: Core Framework, LSP, Tracing Code Generator
Sven Efftinge, Miro Sp?nemann
What's New in Eclipse SDK/Platform?
Lakshmi P Shanmugam
Generic Editor and LSP
Sopot Cela, Mickael Istria
Eclipse Sirius 5.0, All about UX
Mélanie Bats, Stéphane Bégaudeau
News and Social Media
We're proud to announce the arrival of Eclipse Oxygen, the 12th annual simultaneous release from the Eclipse Community. DOWNLOAD NOW!
Find out more about the latest Eclipse Simultaneous Release in the June issue of the Eclipse Newsletter!
Download and test release candidate 3 for Eclipse Oxygen!
#EclipseOxygen下次自动登录
现在的位置:
& 综合 & 正文
如何在eclipse dump Java内存占用情况和打印GC LOG
当使用java开发应用程序发生内存泄露的时候,经常会需要dump内存,然后使用内存分析工具,比如Eclipse Memory Analyzer(一般称作MAT)工具。
本文将介绍如何在eclipse中dump 内存。
提前准备:
  一、下载MAT : 
二、测试代码如下:
package com.memoryLeakA
import java.util.ArrayL
import java.util.L
public class MemoryLeakDemo {
public static void main(String[] args) {
List&String& list = new ArrayList&String&();
while (true) {
list.add("OutOfMemoryError soon");
右键选择 run configurations
找到Arguments -----&VM arguments
-XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath=c:/memoryLeakDemo.hprof-XX:+PrintGCDetails -XX:+PrintGCDateStamps
-XX:+PrintGCApplicationConcurrentTime
-XX:+PrintGCApplicationStoppedTime
-Xloggc:c:/memoryLeakDemoGc.log
点击Run运行。即可出现内存dump现象:
在c:/test目录下会出现两个文件:
其中memoryLeakDemo.hprof为dump的内存情况。
memoryleakDemoGc.log为打印的jvm gc 垃圾回收情况
使用Eclipse Memory Analyzer(MAT)打开memoryLeakDemo.hprof
,即可看到可疑的内存泄露情况,如下图:
打开memoryleakDemoGc.log日志:
出现类似于下图情况,可根据日志分析垃圾回收情况,从而分析JVM 内存使用情况。关于GC日志如何分析,请google之,将来会写文章介绍。
Application time: 0.0072104 seconds
T18:08:09.518+: [GC 0.079: [DefNew: 4017K-&261K(4928K), 0.0020189 secs] 4017K-&K), 0.0020804 secs] [Times: user=0.00 sys=0.00, real=0.01 secs]
Total time for which application threads were stopped: 0.0118427 seconds
Application time: 0.0015514 seconds
T18:08:09.531+: [GC 0.092: [DefNew: 2095K-&0K(4928K), 0.0022178 secs] 3258K-&K), 0.0022986 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
Total time for which application threads were stopped: 0.0023873 seconds
Application time: 0.0021970 seconds
T18:08:09.536+: [GC 0.097: [DefNew: 2618K-&0K(4928K), 0.0027436 secs] 5788K-&K), 0.0027797 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
Total time for which application threads were stopped: 0.0029137 seconds
Application time: 0.0033047 seconds
T18:08:09.542+: [GC 0.103: [DefNew: 3927K-&0K(4928K), 0.0040692 secs]0.107: [Tenured: 9715K-&K), 0.0078907 secs] 9715K-&K), [Perm : 376K-&376K(12288K)], 0.0120529 secs] [Times: user=0.00 sys=0.00, real=0.01 secs]
Total time for which application threads were stopped: 0.0121337 seconds
Application time: 0.0051220 seconds
T18:08:09.559+: [GC 0.120: [DefNew: 0K-&0K(4992K), 0.0019689 secs]0.122: [Tenured: 10078K-&K), 0.0086661 secs] 10078K-&K), [Perm : 376K-&376K(12288K)], 0.0107276 secs] [Times: user=0.00 sys=0.00, real=0.01 secs]
Total time for which application threads were stopped: 0.0108428 seconds
Application time: 0.0088859 seconds
T18:08:09.579+: [GC 0.140: [DefNew: 0K-&0K(4992K), 0.0026499 secs]0.143: [Tenured: 14987K-&K), 0.0113583 secs] 14987K-&K), [Perm : 376K-&376K(12288K)], 0.0141102 secs] [Times: user=0.02 sys=0.00, real=0.01 secs]
Total time for which application threads were stopped: 0.0142300 seconds
Application time: 0.0131855 seconds
T18:08:09.606+: [GC 0.167: [DefNew: 0K-&0K(8960K), 0.0041453 secs]0.172: [Tenured: 22350K-&1K), 0.0153709 secs] 22350K-&1K), [Perm : 376K-&376K(12288K)], 0.0196298 secs] [Times: user=0.01 sys=0.00, real=0.02 secs]
Total time for which application threads were stopped: 0.0197569 seconds
Application time: 0.0192821 seconds
T18:08:09.646+: [GC 0.207: [DefNew: 0K-&0K(14976K), 0.0057633 secs]0.212: [Tenured: 33395K-&2K), 0.0206766 secs] 33395K-&2K), [Perm : 376K-&376K(12288K)], 0.0265551 secs] [Times: user=0.03 sys=0.00, real=0.03 secs]
Total time for which application threads were stopped: 0.0266673 seconds
Application time: 0.0289176 seconds
T18:08:09.701+: [GC 0.262: [DefNew: 0K-&0K(23872K), 0.0086104 secs]0.271: [Tenured: 49962K-&3K), 0.0294036 secs] 49962K-&3K), [Perm : 376K-&376K(12288K)], 0.0380994 secs] [Times: user=0.03 sys=0.00, real=0.04 secs]
Total time for which application threads were stopped: 0.0382799 seconds
Application time: 0.0436154 seconds
T18:08:09.783+: [GC 0.344: [DefNew: 0K-&0K(23872K), 0.0131421 secs]0.357: [Tenured: 74812K-&4K), 0.0415558 secs] 74812K-&4K), [Perm : 376K-&376K(12288K)], 0.0548393 secs] [Times: user=0.05 sys=0.00, real=0.06 secs]
Total time for which application threads were stopped: 0.0550578 seconds
Application time: 0.0657430 seconds
T18:08:09.904+: [GC 0.465: [DefNew: 0K-&0K(43968K), 0.0198380 secs]0.485: [Tenured: 112088K-&6K), 0.0608105 secs] 112088K-&6K), [Perm : 376K-&376K(12288K)], 0.0807997 secs] [Times: user=0.08 sys=0.00, real=0.08 secs]
Total time for which application threads were stopped: 0.0809335 seconds
Application time: 0.0991039 seconds
T18:08:10.084+: [GC 0.645: [DefNew: 0K-&0K(74240K), 0.0293317 secs]0.674: [Tenured: 168002K-&4784K), 0.0895410 secs] 168002K-&9024K), [Perm : 376K-&376K(12288K)], 0.1189829 secs] [Times: user=0.12 sys=0.00, real=0.12
T18:08:10.203+: [Full GC 0.764: [Tenured: 100905K-&4784K), 0.0861601 secs] 100905K-&3440K), [Perm : 376K-&371K(12288K)], 0.0862167 secs] [Times: user=0.08 sys=0.00, real=0.09 secs]
Total time for which application threads were stopped: 0.2053870 seconds
Application time: 0.0006161 seconds
Total time for which application threads were stopped: 0.5625090 seconds
def new generation
total 78656K, used 2190K [0xx29bebe0000)
eden space 69952K,
3% used [0xx248b3bd8, 0x28ae0000)
from space 8704K,
0% used [0x28aeae60000)
space 8704K,
0% used [0xxx29be0000)
tenured generation
total 174784K, used 100892K [0x29be990000)
the space 174784K,
57% used [0x29befe6fe690000)
compacting perm gen
total 12288K, used 371K [0xxx)
the space 12288K,
3% used [0xx346ecf38, 0x346ed000, 0x)
ro space 10240K,
55% used [0xx38c1c190000)
rw space 12288K,
55% used [0xx, 0xx39c90000)
Application time: 0.0016332 seconds
&&&&推荐文章:
【上篇】【下篇】eclipse启动优化(一)
阅读:6844次
&首先了解下JVM中几个相关的概念:
Xms:最小堆大小
Xmx:最大堆大小
Xmn:年轻代堆大小
Xss:每个线程的堆大小
PermSize:初始持久代大小
MaxPermSize:最大持久代大小
一般Xms、Xmx设置相同,PermSize、MaxPermSize设置相同,这样可以避免伸缩堆大小带来的性能损耗。
首先eclipse安装根目录下打开eclipse.ini,加上配置:
-Xloggc:gc.log
-XX:+PrintGCTimeStamps
-XX:+PrintGCDetails
目的是运行eclipse的时候可以打出详细gc过程。
启动eclipse,然后打开gc.log一看,哇塞启动一次就做了几十次GC,包括不少次Full GC,着手优化&&
先解决Full GC的问题:
3.159: [Full GC 3.159: [Tenured: 22716K-&2K), 0.1116536 secs] 38493K-&2K), [Perm : 20479K-&2K)], 0.1117614 secs] [Times: user=0.11 sys=0.00, real=0.11 secs]&
3.706: [Full GC 3.706: [Tenured: 26133K-&2K), 0.1235449 secs] 40042K-&2K), [Perm : 24575K-&2K)], 0.1236474 secs] [Times: user=0.13 sys=0.00, real=0.13 secs]&
如上GC日志可以看出,Full GC主要是针对Tenured、Perm区的GC,好那先调整Perm大小,指定充裕的持久代区域,eclipse.ini中加入:
-XX:PermSize=128m
-XX:MaxPermSize=128m
再次启动看gc.log,Full GC没有了,但是还有很多次普通GC,说明还是需要进一步优化。
eclipse的初始堆大小分配得很小,因此不利于年轻代堆大小的分配,如果设置的年轻代堆大小Xmn大于最小堆大小Xms,eclipse将无法启动。
因此,将Xms调整为512m,重启动后观察GC大幅减少。
最后调整Xmn,年轻代堆大小,经过反复比较后,发现设置&-Xmn256m&效果最优。
优化后的GC日志:
3.203: [GC 3.204: [DefNew: 209776K-&2K), 0.0876304 secs] 209776K-&2K), 0.0876921 secs] [Times: user=0.09 sys=0.00, real=0.09 secs]&
5.422: [GC 5.422: [DefNew: 235968K-&1K), 0.0989335 secs] 236976K-&3K), 0.0990229 secs]
在接近6秒的启动时间内,eclipse总共只做了2次普通GC回收,怎么样效果明显吧!
原文出处:http://blog.csdn.net/tomato8524/article/details/7428742
(转载本站文章请注明作者和出处
,请勿用于任何商业用途)
寻找遗失儿童』
&&&&本站90%以上文章均属原创,部分转载已加上原作者出处。
如需转载本站文章请您务必保留本站出处!
&&&&打广告评论者请自重,请为广大网友提供一个健康干净的网络空间。
感谢提供网站空间;
感谢提供域名解析;
感谢提供CMS系统;
感谢展示本站前端页面;
感谢提供字体;
感谢大家一直以来对本站的喜爱,感谢大家!
掏出手机搞事情,关注我们官方微信(ThinkDiary)公众账号如何在eclipse dump Java内存占用情况和打印GC LOG - 推酷
如何在eclipse dump Java内存占用情况和打印GC LOG
当使用java开发应用程序发生内存泄露的时候,经常会需要dump内存,然后使用内存分析工具,比如Eclipse Memory Analyzer(一般称作MAT)工具。
本文将介绍如何在eclipse中dump 内存。
提前准备:
一、下载MAT :
二、测试代码如下:
package com.memoryLeakA
import java.util.ArrayL
import java.util.L
public class MemoryLeakDemo {
public static void main(String[] args) {
List&String& list = new ArrayList&String&();
while (true) {
list.add(&OutOfMemoryError soon&);
右键选择 run configurations&
找到Arguments -----&VM arguments&
-XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath=c:/memoryLeakDemo.hprof
-XX:+PrintGCDetails&
-XX:+PrintGCDateStamps&
-XX:+PrintGCApplicationConcurrentTime
-XX:+PrintGCApplicationStoppedTime &
-Xloggc:c:/memoryLeakDemoGc.log
点击Run运行。即可出现内存dump现象:
在c:/test目录下会出现两个文件:
其中memoryLeakDemo.hprof为dump的内存情况。
memoryleakDemoGc.log为打印的jvm gc 垃圾回收情况
Eclipse Memory Analyzer(MAT)打开
memoryLeakDemo.hprof ,即可看到可疑的内存泄露情况,如下图:
memoryleakDemoGc.log日志:
出现类似于下图情况,可根据日志分析垃圾回收情况,从而分析JVM 内存使用情况。关于GC日志如何分析,请google之,将来会写文章介绍。
Application time: 0.0072104 seconds
T18:08:09.518+: [GC 0.079: [DefNew: 4017K-&261K(4928K), 0.0020189 secs] 4017K-&K), 0.0020804 secs] [Times: user=0.00 sys=0.00, real=0.01 secs]&
Total time for which application threads were stopped: 0.0118427 seconds
Application time: 0.0015514 seconds
T18:08:09.531+: [GC 0.092: [DefNew: 2095K-&0K(4928K), 0.0022178 secs] 3258K-&K), 0.0022986 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]&
Total time for which application threads were stopped: 0.0023873 seconds
Application time: 0.0021970 seconds
T18:08:09.536+: [GC 0.097: [DefNew: 2618K-&0K(4928K), 0.0027436 secs] 5788K-&K), 0.0027797 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]&
Total time for which application threads were stopped: 0.0029137 seconds
Application time: 0.0033047 seconds
T18:08:09.542+: [GC 0.103: [DefNew: 3927K-&0K(4928K), 0.0040692 secs]0.107: [Tenured: 9715K-&K), 0.0078907 secs] 9715K-&K), [Perm : 376K-&376K(12288K)], 0.0120529 secs] [Times: user=0.00 sys=0.00, real=0.01 secs]&
Total time for which application threads were stopped: 0.0121337 seconds
Application time: 0.0051220 seconds
T18:08:09.559+: [GC 0.120: [DefNew: 0K-&0K(4992K), 0.0019689 secs]0.122: [Tenured: 10078K-&K), 0.0086661 secs] 10078K-&K), [Perm : 376K-&376K(12288K)], 0.0107276 secs] [Times: user=0.00 sys=0.00, real=0.01 secs]&
Total time for which application threads were stopped: 0.0108428 seconds
Application time: 0.0088859 seconds
T18:08:09.579+: [GC 0.140: [DefNew: 0K-&0K(4992K), 0.0026499 secs]0.143: [Tenured: 14987K-&K), 0.0113583 secs] 14987K-&K), [Perm : 376K-&376K(12288K)], 0.0141102 secs] [Times: user=0.02 sys=0.00, real=0.01 secs]&
Total time for which application threads were stopped: 0.0142300 seconds
Application time: 0.0131855 seconds
T18:08:09.606+: [GC 0.167: [DefNew: 0K-&0K(8960K), 0.0041453 secs]0.172: [Tenured: 22350K-&1K), 0.0153709 secs] 22350K-&1K), [Perm : 376K-&376K(12288K)], 0.0196298 secs] [Times: user=0.01 sys=0.00, real=0.02 secs]&
Total time for which application threads were stopped: 0.0197569 seconds
Application time: 0.0192821 seconds
T18:08:09.646+: [GC 0.207: [DefNew: 0K-&0K(14976K), 0.0057633 secs]0.212: [Tenured: 33395K-&2K), 0.0206766 secs] 33395K-&2K), [Perm : 376K-&376K(12288K)], 0.0265551 secs] [Times: user=0.03 sys=0.00, real=0.03 secs]&
Total time for which application threads were stopped: 0.0266673 seconds
Application time: 0.0289176 seconds
T18:08:09.701+: [GC 0.262: [DefNew: 0K-&0K(23872K), 0.0086104 secs]0.271: [Tenured: 49962K-&3K), 0.0294036 secs] 49962K-&3K), [Perm : 376K-&376K(12288K)], 0.0380994 secs] [Times: user=0.03 sys=0.00, real=0.04 secs]&
Total time for which application threads were stopped: 0.0382799 seconds
Application time: 0.0436154 seconds
T18:08:09.783+: [GC 0.344: [DefNew: 0K-&0K(23872K), 0.0131421 secs]0.357: [Tenured: 74812K-&4K), 0.0415558 secs] 74812K-&4K), [Perm : 376K-&376K(12288K)], 0.0548393 secs] [Times: user=0.05 sys=0.00, real=0.06 secs]&
Total time for which application threads were stopped: 0.0550578 seconds
Application time: 0.0657430 seconds
T18:08:09.904+: [GC 0.465: [DefNew: 0K-&0K(43968K), 0.0198380 secs]0.485: [Tenured: 112088K-&6K), 0.0608105 secs] 112088K-&6K), [Perm : 376K-&376K(12288K)], 0.0807997 secs] [Times: user=0.08 sys=0.00, real=0.08 secs]&
Total time for which application threads were stopped: 0.0809335 seconds
Application time: 0.0991039 seconds
T18:08:10.084+: [GC 0.645: [DefNew: 0K-&0K(74240K), 0.0293317 secs]0.674: [Tenured: 168002K-&4784K), 0.0895410 secs] 168002K-&9024K), [Perm : 376K-&376K(12288K)], 0.1189829 secs] [Times: user=0.12 sys=0.00, real=0.12 secs]&
T18:08:10.203+: [Full GC 0.764: [Tenured: 100905K-&4784K), 0.0861601 secs] 100905K-&3440K), [Perm : 376K-&371K(12288K)], 0.0862167 secs] [Times: user=0.08 sys=0.00, real=0.09 secs]&
Total time for which application threads were stopped: 0.2053870 seconds
Application time: 0.0006161 seconds
Total time for which application threads were stopped: 0.5625090 seconds
def new generation & total 78656K, used 2190K [0xx29bebe0000)
eden space 69952K, & 3% used [0xx248b3bd8, 0x28ae0000)
from space 8704K, & 0% used [0x28aeae60000)
to & space 8704K, & 0% used [0xxx29be0000)
tenured generation & total 174784K, used 100892K [0x29be990000)
the space 174784K, &57% used [0x29befe6fe690000)
compacting perm gen &total 12288K, used 371K [0xxx)
the space 12288K, & 3% used [0xx346ecf38, 0x346ed000, 0x)
ro space 10240K, &55% used [0xx38c1c190000)
rw space 12288K, &55% used [0xx, 0xx39c90000)
Application time: 0.0016332 seconds
已发表评论数()
请填写推刊名
描述不能大于100个字符!
权限设置: 公开
仅自己可见
正文不准确
标题不准确
排版有问题
主题不准确
没有分页内容
图片无法显示
视频无法显示
与原文不一致}

我要回帖

更多关于 catalina.sh gc 调优 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信