1.错误案例
www@Ubuntu:~/Downloads$ jmap -heap 3991
Attaching to process ID 3991, please wait...
Error attaching to process: sun.jvm.hotspot.debugger.DebuggerException: Can't attach to the process
2.解决方案
1)修改/etc/sysctl.d/10-ptrace.conf文件如下:
< kernel.yama.ptrace_scope = 1 --- > kernel.yama.ptrace_scope = 0
(即将1改成0)
2)重启
3.成功
www@ubuntu:~$ jmap -heap 1835
Attaching to process ID 1835, please wait...
Debugger attached successfully.
Client compiler detected.
JVM version is 20.0-b11
using thread-local object allocation.
Mark Sweep Compact GC
Heap Configuration:
MinHeapFreeRatio = 40
MaxHeapFreeRatio = 70
MaxHeapSize = 402653184 (384.0MB)
NewSize = 1048576 (1.0MB)
MaxNewSize= 4294901760 (4095.9375MB)
OldSize = 4194304 (4.0MB)
NewRatio = 2
SurvivorRatio= 8
PermSize = 12582912 (12.0MB)
MaxPermSize = 268435456 (256.0MB)
Heap Usage:
New Generation (Eden + 1 Survivor Space):
capacity = 13697024 (13.0625MB)
used = 6592008 (6.286628723144531MB)
free = 7105016 (6.775871276855469MB)
48.12730122981459% used
Eden Space:
capacity = 12189696 (11.625MB)
used = 6592008 (6.286628723144531MB)
free = 5597688 (5.338371276855469MB)
54.07852665070565% used
From Space:
capacity = 1507328 (1.4375MB)
used = 0 (0.0MB)
free = 1507328 (1.4375MB)
0.0% used
To Space:
capacity = 1507328 (1.4375MB)
used = 0 (0.0MB)
free = 1507328 (1.4375MB)
0.0% used
tenured generation:
capacity = 30273536 (28.87109375MB)
used = 18162752 (17.32135009765625MB)
free = 12110784 (11.54974365234375MB)
59.995475916655394% used
Perm Generation:
capacity = 38273024 (36.5MB)
used = 38107752 (36.342384338378906MB)
free = 165272 (0.15761566162109375MB)
99.56817626953125% used