Java Memory Regions - Heap Stack Code and Static Memory Diagram - Learn Java - APPFICIAL
Описание
A program's memory usage typically includes four different regions:
Code — The region where the program instructions are stored.
Static memory — The region where static fields and local variables (variables declared inside methods starting with the keyword "static") are allocated. The name "static" comes from these variables not changing (static means not changing); they are allocated once and last for the duration of a program's execution, their addresses staying the same.
Stack — The region where a method's local variables are allocated during a method call. A method call adds local variables to the stack, and a return removes them.
Heap — The region where the "new" operator allocates memory for objects. The region is also called free store.
In Java, the code and static memory regions are actually integrated into a region of memory called the method area , which also stores information for every class type used in the program.
Рекомендуемые видео



















