S0C: 新生代中Survivor space 0区总空间 S1C: 新生代中Survivor space 1区总空间 S0U:新生代中Survivor space 0区已使用空间 S1U:新生代中Survivor space 1区已使用空间 EC: 新生代中总空间 EU:新生代已使用空间 OC: 老年代总空间 OU:老年代中已使用空间 MC:方法区大小 MU:方法区使用大小 CCSC:压缩类空间大小 CCSU:压缩类空间使用大小 YGC: 从应用程序启动到当前,发生Yang GC 的次数 YGCT: 从应用程序启动到当前,Yang GC所用的时间【单位秒】 FGC: 从应用程序启动到当前,发生Full GC的次数 FGCT: 从应用程序启动到当前,Full GC所用的时间 GCT: 从应用程序启动到当前,用于垃圾回收的总时间【单位秒】
4. jmap 打印指定Java进程(或核心文件、远程调试服务器)的共享对象内存映射或堆内存细节
bogon:~ hzjdemac$ jmap -help
Usage:
jmap [option]
(to connect to running process)
jmap [option]
(to connect to a core file)
jmap [option] [server_id@]
(to connect to remote debug server)
where
is one of:
to print same info as Solaris pmap
-heap to print java heap summary //打印jvm heap的情况,例如GC收集器,参数配置,JVM内存分区情况
-histo[:live] to print histogram of java object heap; if the "live"
suboption is specified, only count live objects //打印jvm heap的直方图。其输出信息包括类名,对象数量,对象占用大小
-clstats to print class loader statistics
-finalizerinfo to print information on objects awaiting finalization
-dump: to dump java heap in hprof binary format
dump-options:
live dump only live objects; if not specified,
all objects in the heap are dumped.
format=b binary format
file= dump heap to
Example: jmap -dump:live,format=b,file=heap.bin
-F force. Use with -dump: or -histo
to force a heap dump or histogram when does not
respond. The "live" suboption is not supported
in this mode.
-h | -help to print this help message
-J to pass directly to the runtime system
示例
bogon:~ hzjdemac$ jmap -heap 16229
Attaching to process ID 16229, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.101-b13
using thread-local object allocation.
Parallel GC with 8 thread(s)
Heap Configuration: //#堆内存初始化配置
MinHeapFreeRatio = 0 //-XX:MinHeapFreeRatio设置JVM堆最小空闲比率
MaxHeapFreeRatio = 100 //-XX:MaxHeapFreeRatio设置JVM堆最大空闲比率
MaxHeapSize = 4294967296 (4096.0MB) //-XX:MaxHeapSize=设置JVM堆的最大大小
NewSize = 89128960 (85.0MB) //-XX:NewSize=设置JVM堆新生代的默认大小
MaxNewSize = 1431306240 (1365.0MB) //-XX:MaxNewSize=设置JVM堆的‘新生代’的最大大小
OldSize = 179306496 (171.0MB) //-XX:OldSize=设置JVM堆的‘老生代’的大小
NewRatio = 2 //#-XX:NewRatio=:‘新生代’和‘老生代’的大小比率
SurvivorRatio = 8 //-XX:SurvivorRatio=设置年轻代中Eden区与Survivor区的大小比值
MetaspaceSize = 21807104 (20.796875MB) //-XX:PermSize=:设置JVM堆的‘持久代’的初始大小
CompressedClassSpaceSize = 1073741824 (1024.0MB)
MaxMetaspaceSize = 17592186044415 MB
G1HeapRegionSize = 0 (0.0MB)
Heap Usage:
PS Young Generation
Eden Space:
capacity = 67108864 (64.0MB)
used = 4026944 (3.84039306640625MB)
free = 63081920 (60.15960693359375MB)
6.000614166259766% used
From Space:
capacity = 11010048 (10.5MB)
used = 0 (0.0MB)
free = 11010048 (10.5MB)
0.0% used
To Space:
capacity = 11010048 (10.5MB)
used = 0 (0.0MB)
free = 11010048 (10.5MB)
0.0% used
PS Old Generation
capacity = 179306496 (171.0MB)
used = 0 (0.0MB)
free = 179306496 (171.0MB)
0.0% used
758 interned Strings occupying 50832 bytes.
bogon:~ hzjdemac$ jmap -histo 16229
num #instances #bytes class name
----------------------------------------------
1: 439 4642832 [I
2: 2553 347560 [C
3: 731 145760 [B
4: 487 55504 java.lang.Class
5: 1699 40776 java.lang.String
6: 584 30504 [Ljava.lang.Object;
7: 115 8280 java.lang.reflect.Field
8: 199 6368 java.io.File
9: 238 5712 java.lang.StringBuilder
10: 89 5696 java.net.URL
11: 11 4136 java.lang.Thread
12: 258 4128 java.lang.Integer
13: 98 3920 java.lang.ref.SoftReference
14: 122 3904 java.util.Hashtable$Entry
...
bogon:~ hzjdemac$ jmap -dump:format=b,file=a.log 16229 //保存快照
Dumping heap to /Users/hzjdemac/a.log ...
Heap dump file created
bogon:~ hzjdemac$ jstack -help
Usage:
jstack [-l]
(to connect to running process)
jstack -F [-m] [-l]
(to connect to a hung process)
jstack [-m] [-l]
(to connect to a core file)
jstack [-m] [-l] [server_id@]
(to connect to a remote debug server)
Options:
-F to force a thread dump. Use when jstack does not respond (process is hung)
-m to print both java and native frames (mixed mode)
-l long listing. Prints additional information about locks
-h or -help to print this help message
示例
bogon:~ hzjdemac$ jstack 16229
2019-03-18 18:27:04
Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.101-b13 mixed mode):
"Attach Listener" #13 daemon prio=9 os_prio=31 tid=0x00007fa6c5001000 nid=0xc07 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"DestroyJavaVM" #12 prio=5 os_prio=31 tid=0x00007fa6c589f000 nid=0x1803 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"Thread-1" #11 prio=5 os_prio=31 tid=0x00007fa6c589e000 nid=0x5603 waiting for monitor entry [0x000070000c031000]
java.lang.Thread.State: BLOCKED (on object monitor)
at chapter1.DeadLockDemo$2.run(DeadLockDemo.java:38)
- waiting to lock <0x000000076abaccd8> (a java.lang.String)
- locked <0x000000076abacd08> (a java.lang.String)
at java.lang.Thread.run(Thread.java:745)
"Thread-0" #10 prio=5 os_prio=31 tid=0x00007fa6c589d800 nid=0xa903 waiting for monitor entry [0x000070000bf2e000]
java.lang.Thread.State: BLOCKED (on object monitor)
at chapter1.DeadLockDemo$1.run(DeadLockDemo.java:28)
- waiting to lock <0x000000076abacd08> (a java.lang.String)
- locked <0x000000076abaccd8> (a java.lang.String)
at java.lang.Thread.run(Thread.java:745)
...
快速高效用:SET SQL_SAFE_UPDATES = 0;下面的就不要看了!
今日用MySQL Workbench进行数据库的管理更新时,执行一个更新的语句碰到以下错误提示:
Error Code: 1175
You are using safe update mode and you tried to update a table without a WHERE that
Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.
Note:You may assume that nums1 has enough space (size that is