The first part goes into Java 1th Chapter into the Java Part II automatic memory management mechanism 2nd Chapter Java memory area and memory overflow exception 2.1 Overview 2.2 Run Time data region 2.2.1 Program Counter 2.2.2 Java Virtual machine stack 2.2.3 Local Method Stack 2.2.4 Java Heap 2.2.5 Method Area 2.2.6 Run a constant-rate pool 2.2.7 Direct Memory 2.3 Hotspot Virtual Machine Object Quest creation of 2.3.1 Objects memory layout for 2.3.2 Objects access positioning for 2.3.3 objects 2.4 Combat: OutOfMemoryError Anomaly 2.4.1 Java Heap Overflow 2.4.2 Virtual machine stack and local method stack Overflow 2.4.3 Method area and run frequent pool overflow 2.4.4 Native Direct Memory Overflow 2.5 Summary of this chapter 3rd Chapter garbage Collector and memory allocation strategy 4th Virtual machine performance monitoring and fault handling tools the 5th chapter of the case analysis and actual combat Part III Virtual machine execution Subsystem 6th Chapter class file Structure 7th Chapter Virtual machine class loading mechanism 8th Chapter Virtual machine byte code execution engine 9th Chapter Class loading and execution subsystem's case and actual combat part Fourth program compilation and code optimization 10th. Early morning (compile period) optimization 11th Chapter Advanced (Operation period) optimization part Fifth high-efficiency concurrency 12th Chapter Java memory model and thread 13th chapter thread Safety and lock optimization
We can do it. Java programming language, Java Virtual machine, Java API Class library these three parts are collectively referred to as JDK (Java Development Kit), the JDK is the minimum environment to support Java program development. In addition, the Javase API subset in the Java API Class library and the Java Virtual machine are collectively referred to as JRE (Java Runtime Environment), and the JRE is a standard environment that supports Java program operations.
Where the methods of the class exist.
When a class is loaded, the method information is stored in a piece of memory called a method area and is not created with the object and stored in the heap with the object. Refer to the first few chapters of the deep Java virtual machine.
If instance method also increases with instance, that memory consumption is too large, in order to achieve a small memory, Java is based on this keyword, such as: Instance1.instancemethod (); Instance2.instancemethod (); When passed to an object parameter, the Java compiler automatically adds a This parameter, which means that the object reference is passed, although the two objects share a method, but the data generated in their method is private, because the parameter is passed into the entry in call stack , and each object has a different call stack, so it's not confusing. In fact, when you call each non-static method, the Java compiler automatically adds the arguments that are currently calling this method object, and sometimes calls another method in one method, which you can not precede with this, because the object argument to pass is the object that currently executes the method.