JVM native method stack, heap

Native method stack

  1. It mainly stores a lot of c/c++ code instead of java code
  2. Because jvm needs to interact with the operating system through c/c++ code.

Heap

  1. Heap
    1. Through the new keyword, the heap memory is used to create an object.
    2. Features
      1. It is shared by threads, and all objects in the heap need to consider thread safety
      2. Has a garbage collection mechanism
    3. Heap memory diagnosis
      1. jps tool
        1. View which java processes are in the current system
      2. jmap tool
        1. View heap memory usage jmap-head process id (non-continuous)
      3. jconsole tool
        1. Graphical interface, multi-functional testing tool that can continuously test
    4. Thinking
      1. After garbage collection, the memory usage is still very high
      . 1. The problem is that the methods in the program are being called all the time, and they are still being used during garbage collection and cannot be garbage collected.

Guess you like

Origin blog.csdn.net/qq_45788043/article/details/112205018