Table of Contents jmap View heap usage View the class list, including the number of instances and memory size occupied Generate heap dump snapshot dump file of jvm jstat View gc information, check the number of gc times, and time Check the usage and size of three generations (young/old/perm) objects in VM memory View metadata […]
Tag: jmap
[Java executable commands] (20) Heap dump snapshot file and heap information viewing tool jmap: generate multi-format heap dump files, print class loader information and view shared object mapping information ~
jmap of Java executable commands 1 concept 2 Advantages and disadvantages 3 use 3.1 Syntax format 3.2 Generating a heap dump file 3.3 Execute the jmap command to check the memory usage 3.4 Execute the jmap command to print object statistics 4 Application scenarios Summarize 1 concept jmap is a tool that comes with Java […]
Linux troubleshooting java cpu too high problem, JPS, JMAP, JSTAT, JSTACK and JCMD
code: [root@localhost cpu]# cat Test.java public class Test { public static void main(String[] args) { new Thread(()->{ System.out.println(“11111″); while(true) { } },”thread1”).start(); new Thread(()->{ System.out.println(“2222″); try { Thread. sleep(100000L); } catch (InterruptedException e) { throw new RuntimeException(e); } },”thread2”).start(); new Thread(()->{ System.out.println(“33333”); try { Thread. sleep(100000L); } catch (InterruptedException e) { throw new RuntimeException(e); } […]
Why implements Serializable? How to use jmap to view the heap in JVM?
Example A serialized object of User is defined here: Here is a test for writing to a file, that is, trying to serialize an object: java copy code @RestController public class TestController { @GetMapping(“/write”) public static void writeObj() { User user = new User(“sc”, 1); try { ObjectOutputStream objectOutputStream = new ObjectOutputStream(Files.newOutputStream(Paths.get(“/Users/suncong/Desktop/user.txt”))); objectOutputStream.writeObject(user); objectOutputStream. close(); […]
JVM memory analysis tools jstack, jstat, jmap
jstack, jstat, and jmap are the memory analysis tools that come with jdk, which can help us analyze the running status of heap, memory, and threads. jstack 1) View the stack information of the thread, that is, the thread snapshot at the current moment of the JVM. 2) It is mainly used to locate the […]
[Solved] The Java program does not have permission to access the Jmap solution in the docker container Operation not permitted
Attaching to process ID 8, please wait… Error attaching to process: sun.jvm.hotspot.debugger.DebuggerException: Can’t attach to the process: ptrace(PTRACE_ATTACH, ..) failed for 8: Operation not permitted sun.jvm.hotspot.debugger.DebuggerException: sun.jvm.hotspot.debugger.DebuggerException: Can’t attach to the process: ptrace(PTRACE_ATTACH, ..) failed for 8: Operation not permitted at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal$LinuxDebuggerLocalWorkerThread.execute(LinuxDebuggerLocal.java:163) at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.attach(LinuxDebuggerLocal.java:278) at sun.jvm.hotspot.HotSpotAgent.attachDebugger(HotSpotAgent.java:671) at sun.jvm.hotspot.HotSpotAgent.setupDebuggerLinux(HotSpotAgent.java:611) at sun.jvm.hotspot.HotSpotAgent.setupDebugger(HotSpotAgent.java:337) at sun.jvm.hotspot.HotSpotAgent.go(HotSpotAgent.java:304) at sun.jvm.hotspot.HotSpotAgent.attach(HotSpotAgent.java:140) at […]
[Solved] jmap error in Docker: Can’t attach to the process: ptrace(PTRACE_ATTACH problem
Started a java service through docker. Log in to the container, view jvm related information through jmap, and report an error: # jmap -heap 6 Attaching to process ID 6, please wait… Error attaching to process: sun.jvm.hotspot.debugger.DebuggerException: Can’t attach to the process: ptrace(PTRACE_ATTACH, ..) failed for 6: Operation not permitted sun.jvm.hotspot.debugger.DebuggerException: sun.jvm.hotspot.debugger.DebuggerException: Can’t attach to […]