forked from karthickow/ImpCommands
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJava.txt
95 lines (74 loc) · 3.08 KB
/
Java.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
java -classpath jarfilelocation classname
java -classpath "C:\Program Files\IBM\SDP\runtimes\base_v7\java\jre\lib\xml.jar" org.apache.xalan.Version
java -cp "C:\Program Files\IBM\SDP\runtimes\base_v7\java\jre\lib\xml.jar" org.apache.xalan.Version
--JVM troubleshooting tool
jinfo -flag MaxPermSize 5144
jvisualvm
jvisualvm --console new
jstat -gc 5612 5s -- Seconds
jstat -gc 5612 5ms --milli seconds
jstat -gcutil 6436
jstat -gcutil 6436 250 7 -- 7 samples at 250 millisecond intervals
jstat -gcnew -h3 6436 250 -- output the column header after every 3 lines of data.
jstat -gcutil -t 6436 250 3 -- 3 samples at 250 millisecond intervals with timestamp
--to get the process ID (pid)
jps -mlvV
jps -m
-- To find PermGen leaks
jmap -heap 5144
jmap -permstat 18254 > permstats_2.txt
jmap -histo:live 18254 > histo_live.txt
jmap -histo 18254 > histo.txt
jmap -dump:format=b,file=leak 3144
jmap -finalizerinfo
jmap -histo:live 5612 | more
-- Trace loading of classes.
-XX:-TraceClassLoading
--Trace unloading of classes.
-XX:-TraceClassUnloading
-- Trace all classes loaded in order referenced (not loaded).
-XX:-TraceClassLoadingPreorder
-- Trace constant pool resolutions. (Introduced in 1.4.2.)
-XX:-TraceClassResolution
-- To read heap dump
jhat -J-Xmx512m leak
jconsole 5144
--Temporary Solution for OutOfMemoryError PermGen Space Error
-XX:+UseConcMarkSweepGC
-XX:+CMSPermGenSweepingEnabled -- deprecated
-XX:+CMSClassUnloadingEnabled
-XX:PermSize=256M
-XX:MaxPermSize=512M
-XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath=E:/log
-- IBM heap analyser tool
java –Xmx1000m –jar ha135.jar
-- Output GC to file each time it runs
-verbose:gc
-XX:+PrintGCDetails
-XX:+PrintGCTimeStamps
-Xloggc:E:/log/gc.log
-XX:-DisableExplicitGC - By default calls to System.gc() are enabled (-XX:-DisableExplicitGC). Use -XX:+DisableExplicitGC to disable calls to System.gc(). Note that the JVM still performs garbage collection when necessary.
-XX:+UseConcMarkSweepGC - Use concurrent mark-sweep collection for the old generation. (Introduced in 1.4.1)
-XX:+UseParallelGC - Use parallel garbage collection for scavenges. (Introduced in 1.4.1)
-XX:+UseParallelOldGC - Use parallel garbage collection for the full collections. Enabling this option automatically sets -XX:+UseParallelGC. (Introduced in 5.0 update 6.)
-XX:+UseSerialGC - Use serial garbage collection. (Introduced in 5.0.)
-server
-Xms512m
-Xmx512m
-XX:MaxPermSize=256m
-XX:+UseConcMarkSweepGC
-XX:+CMSPermGenSweepingEnabled
-XX:+CMSClassUnloadingEnabled
-verbose:gc
-XX:+PrintGCDetails
-XX:+PrintGCTimeStamps
-Xloggc:E:/log/gc.log
-XX:+HeapDumpOnOutOfMemoryError
-Xss512k -- Stack size
-- Ubuntu
java -XX:+PrintFlagsFinal -version | grep -iE 'HeapSize|PermSize|ThreadStackSize'
java -XX:+PrintFlagsFinal -Xms512m -Xmx1024m -Xss512k -XX:PermSize=64m -XX:MaxPermSize=128m -version | grep -iE 'HeapSize|PermSize|ThreadStackSize'
--Windows
java -XX:+PrintFlagsFinal -version | findstr /i "HeapSize PermSize ThreadStackSize"
java -XX:+PrintFlagsFinal -Xms512m -Xmx1024m -Xss512k -XX:PermSize=64m -XX:MaxPermSize=128m -version | findstr /i "HeapSize|PermSize|ThreadStackSize"