In Thinking in Java, the six storage types of Java are listed. The registers should be very familiar with the registers, and the AX, BX, CX, DX, and more, when used. The register is in the CPU, so the speed is particularly fast, but the number is very limited. Unable to deal directly with the registers in Java, but in c can declare the register variables.
2. The stack space has been compiled and is very kind. Is it not a stack and out of the assembler? There is a pointer to control the stack space, the allocation space is shifted on the stack pointer, which is the PUSH operation, the release space pointer is moved, which is the POP operation. Of course, C and C are also mainly through the stack allocation space. Because as long as the stack and out stack, the speed is particularly fast. Object reference in Java is assigned by stack, while Java objects are not allocated by stack, which is why Java efficiency is relatively relatively different. By stack allocation space There is a limit to determine the space size at compile, that is, the case where the running memory should be known before running.
3. The heap space is a large memory block. When you need it, you apply for allocation, and the objects in Java are in the pile. However, the recovery of the stack space is more troublesome, so the recycling algorithm of JVM is more complicated. But if the stack space is relatively large, the memory is not finished, and the JVM generally does not initiate the garbage collector. In this case, the efficiency and stack should be almost, but it has not been recycling space. If you want to start the GC from time to time, you can imagine efficiency will be extremely low.
4. Static storage area declares that variables for static because they have been existing (during the running process of the entire program), so they are saved in a static storage area.
5. The constant storage area declares that Final Static is constant, which can be saved in a constant storage area, and the String type object is constant, and a String constant pool is maintained.
6. Other storage non-RAM memory, mainly tape, disk, etc.
The most important thing here should be stacks and piles, the stack should be the most widely used, and the function is usually the process when the function is called in the assembly: 1. Stack (Protection site) 2. Enter method call 3. Find out the stack (recovery On-site) This is just a simple description. The above process may have a lot of nested, but the process is like this, it is also true in other languages.