1. Partitioning of memory
1. Registers
CPU Processing
2. Local Method Area
Related to the system in which it resides
3. Method area
4. Stack memory
5. Heap Memory
2. Stacks and Heaps
1. Stack:
All stored are local variables. And once the scope of the variable belongs to the end, the variable is disposed.
The variables in the stack have a short life cycle, and the update speed will be fast.
Local code block: Defines the life cycle of local variables. Once the local code block is executed, the variables inside will be freed.
2. Heap
Arrays and objects are stored. Whatever new is created, there will be a heap.
Characteristics:
- Each entity has an initial address value.
- Each data in the heap memory has a default initialization value, which differs depending on the data type.
Integer: 0,
Decimals: 0.0 or 0.0f
Char: ' \u0000 ' \u code Unicode, which is a space
object: null
3. Java garbage collection mechanism to automatically reclaim entity content that is no longer used in the heap
[Java Learning Note]java Language Basics Overview of stored partitioning & stacks and stacks