[Java Learning Note]java Language Basics Overview of stored partitioning & stacks and stacks

Source: Internet
Author: User

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:

  1. Each entity has an initial address value.
  2. 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.