{"id":298035,"date":"2021-01-18T03:49:41","date_gmt":"2021-01-17T19:49:41","guid":{"rendered":"http:\/\/4563.org\/?p=298035"},"modified":"2021-01-18T03:49:41","modified_gmt":"2021-01-17T19:49:41","slug":"macos-11-1-%e6%97%a0%e6%b3%95%e4%bd%bf%e7%94%a8-jmap-%e5%91%bd%e4%bb%a4","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=298035","title":{"rendered":"macOS 11.1 \u65e0\u6cd5\u4f7f\u7528 jmap \u547d\u4ee4"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  macOS 11.1 \u65e0\u6cd5\u4f7f\u7528 jmap \u547d\u4ee4               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : justNoBody <\/span>  <span><i><\/i> 20<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u6700\u8fd1\u624d\u53d1\u73b0 macOS \u4e0a jmap \u547d\u4ee4\u65e0\u6cd5\u4f7f\u7528\uff0c\u62a5\u9519\u5982\u4e0b<\/p>\n<pre><code>\u276f jhsdb jmap --heap --pid 14657 Attaching to process ID 14657, please wait... ERROR: attach: task_for_pid(14657) failed: '(os\/kern) failure' (5) Error attaching to process: sun.jvm.hotspot.debugger.DebuggerException: Can't attach to the process. Could be caused by an incorrect pid or lack of privileges. sun.jvm.hotspot.debugger.DebuggerException: sun.jvm.hotspot.debugger.DebuggerException: Can't attach to the process. Could be caused by an incorrect pid or lack of privileges.  at jdk.hotspot.agent\/sun.jvm.hotspot.debugger.bsd.BsdDebuggerLocal$BsdDebuggerLocalWorkerThread.execute(BsdDebuggerLocal.java:170)  at jdk.hotspot.agent\/sun.jvm.hotspot.debugger.bsd.BsdDebuggerLocal.attach(BsdDebuggerLocal.java:284)  at jdk.hotspot.agent\/sun.jvm.hotspot.HotSpotAgent.attachDebugger(HotSpotAgent.java:641)  at jdk.hotspot.agent\/sun.jvm.hotspot.HotSpotAgent.setupDebuggerDarwin(HotSpotAgent.java:629)  at jdk.hotspot.agent\/sun.jvm.hotspot.HotSpotAgent.setupDebugger(HotSpotAgent.java:364)  at jdk.hotspot.agent\/sun.jvm.hotspot.HotSpotAgent.go(HotSpotAgent.java:329)  at jdk.hotspot.agent\/sun.jvm.hotspot.HotSpotAgent.attach(HotSpotAgent.java:139)  at jdk.hotspot.agent\/sun.jvm.hotspot.tools.Tool.start(Tool.java:187)  at jdk.hotspot.agent\/sun.jvm.hotspot.tools.Tool.execute(Tool.java:118)  at jdk.hotspot.agent\/sun.jvm.hotspot.tools.JMap.main(JMap.java:176)  at jdk.hotspot.agent\/sun.jvm.hotspot.SALauncher.runJMAP(SALauncher.java:331)  at jdk.hotspot.agent\/sun.jvm.hotspot.SALauncher.main(SALauncher.java:483) Caused by: sun.jvm.hotspot.debugger.DebuggerException: Can't attach to the process. Could be caused by an incorrect pid or lack of privileges.  at jdk.hotspot.agent\/sun.jvm.hotspot.debugger.bsd.BsdDebuggerLocal.attach0(Native Method)  at jdk.hotspot.agent\/sun.jvm.hotspot.debugger.bsd.BsdDebuggerLocal$1AttachTask.doit(BsdDebuggerLocal.java:275)  at jdk.hotspot.agent\/sun.jvm.hotspot.debugger.bsd.BsdDebuggerLocal$BsdDebuggerLocalWorkerThread.run(BsdDebuggerLocal.java:145) <\/code><\/pre>\n<h2>\u6211\u5c1d\u8bd5\u7684\u89e3\u51b3\u65b9\u6848<\/h2>\n<ol>\n<li>\u6839\u636e https:\/\/bugs.openjdk.java.net\/browse\/JDK-8025666 \u7ed9\u51fa\u7684\u89e3\u51b3\u65b9\u6848\u5c31\u662f\u4f7f\u7528 root \u8d26\u53f7\u6765\u8fd0\u884c\uff0c\u4f46\u6211<code>sudo jhsdb jmap --heap --pid 14657<\/code>\u4e0d\u884c\uff1b<\/li>\n<li>\u68c0\u67e5\u8fc7\u8fd0\u884c\u6240\u4f7f\u7528\u7684 jdk \u548c\u4f7f\u7528 jmap \u547d\u4ee4\u7684 jdk\uff0c\u5747\u662f\u540c\u4e00\u4e2a\u3002<\/li>\n<li>\u5347\u7ea7 jdk \u7248\u672c\u3002\u5728<\/li>\n<\/ol>\n<pre><code>openjdk version \"1.8.0_275\" OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_275-b01) OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.275-b01, mixed mode) <\/code><\/pre>\n<p>\u548c<\/p>\n<pre><code>openjdk version \"15.0.1\" 2020-10-20 OpenJDK Runtime Environment (build 15.0.1+9) OpenJDK 64-Bit Server VM (build 15.0.1+9, mixed mode, sharing) <\/code><\/pre>\n<p>\u4e0a\u9a8c\u8bc1\u4e86\u4e00\u4e0b\u4e5f\u4e0d\u884c<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>1<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"4970460\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Kobayashi <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u76f2\u731c\uff1a\u8fd9\u4e2a\u8fdb\u7a0b ID \u5df2\u88ab\u5176\u4ed6\u7a0b\u5e8f\u5360\u7528\u4e86\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>macOS 11.1 \u65e0\u6cd5\u4f7f\u7528 j&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/298035"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=298035"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/298035\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=298035"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=298035"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=298035"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}