Ubuntu下jmap报错Can't attach to the process

1.错误案例

pfan@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. 重启系统
pfan@ubuntu:~/# reboot

3.成功运行

pfan@ubuntu:~/$ jmap -heap 1567
Attaching to process ID 1567, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 24.60-b09

using thread-local object allocation.
Parallel GC with 4 thread(s)

Heap Configuration:
   MinHeapFreeRatio = 0
   MaxHeapFreeRatio = 100
   MaxHeapSize      = 2147483648 (2048.0MB)
   NewSize          = 1310720 (1.25MB)
   MaxNewSize       = 17592186044415 MB
   OldSize          = 5439488 (5.1875MB)
   NewRatio         = 2
   SurvivorRatio    = 8
   PermSize         = 134217728 (128.0MB)
   MaxPermSize      = 134217728 (128.0MB)
   G1HeapRegionSize = 0 (0.0MB)

Heap Usage:
PS Young Generation
Eden Space:
   capacity = 698351616 (666.0MB)
   used     = 394937704 (376.6419448852539MB)
   free     = 303413912 (289.3580551147461MB)
   56.55284457736545% used
From Space:
   capacity = 8388608 (8.0MB)
   used     = 557056 (0.53125MB)
   free     = 7831552 (7.46875MB)
   6.640625% used
To Space:
   capacity = 8912896 (8.5MB)
   used     = 0 (0.0MB)
   free     = 8912896 (8.5MB)
   0.0% used
PS Old Generation
   capacity = 1431830528 (1365.5MB)
   used     = 5558216 (5.300727844238281MB)
   free     = 1426272312 (1360.1992721557617MB)
   0.38818951623861453% used
PS Perm Generation
   capacity = 134217728 (128.0MB)
   used     = 13828272 (13.187667846679688MB)
   free     = 120389456 (114.81233215332031MB)
   10.302865505218506% used

你可能感兴趣的:(Java,linux,ubuntu,jvm)