JVM Memory Management: An overview of memory management in the Java language

Source: Internet
Author: User
Tags touch

Introduction

Memory management has always been a proud and proud capital of the Java language, allowing Java programmers to fundamentally ignore the details associated with memory management and focus only on business logic. But there is no perfect good in the world, bringing convenience at the same time, it has introduced a lot of maddening memory overflow and leakage problems.

The scary thing is not only that, some programmers who have developed in other languages have put a "memory-less" hat on Java programmers, which is a bit hard to accept. After all, there is no malloc and delete in Java, no destructors, no pointers, how can the programmers who just started to touch Java possibly touch the memory part, let alone a lot of Java programmer still jump professional halfway decent friend.

But although the facts are difficult to accept, but it does have a lot of Java programmer memory This part is not known, although the knowledge of memory, perhaps not to the normal development of the changes and benefits, but it will still imperceptibly improve your technical level, this point after understanding the memory management, I believe you will have a deep understanding.

Memory Partitioning

When it comes to memory, it is a data storage area only when the program is running, and for this area, each virtual machine has its own way of partitioning, but they all have to conform to the Java Virtual machine's basic specifications.

In the virtual machine specification, memory is divided into six parts, namely, PC registers, Java Virtual machine stacks, Java heaps, method areas, run-time pools, and local method stacks.

Java Virtual machine specification and Java Virtual machine

Here you also need to explain the difference between Java Virtual machine specifications and Java virtual machines, as the name implies, Java Virtual Machine specification is a Java Virtual machine implementation of the specification requirements, is made by Oracle, And we usually say that Java virtual machines generally refers to a specific Java Virtual Machine specification implementation. For example, our most commonly used Java Virtual machine hotspot, in fact, there are many Java Virtual machine implementation, even if you have a deep understanding of Java Virtual Machine specifications and interested in it, you can write a Java virtual machine, of course, this is not difficult to imagine the difficulty.

Structure diagram

The diagram below is a structure diagram of a JVM referenced in Baidu Library, which does not run a regular pool because it is an area allocated by the method area.

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.