search
HomeJavaJavagetting StartedWhat are the runtime data areas in JVM

What are the runtime data areas in JVM

First look at the picture:

What are the runtime data areas in JVM

java related video tutorial: java course

1. Program counter (PC)

is exclusive to threads. It is a smaller piece of memory and is the line number indicator of the bytecode executed by the current thread. It is the only area in the Java virtual machine specification that does not specify OOM (OutOfMemoryError).

2. The Java virtual machine stack

is exclusive to threads. The life cycle is the same as that of threads. Is the memory model for Java method execution. Execution of each method creates a stack frame that stores local variables and operands (object references). The memory space required for local variables is allocated during compilation. So the size of the stack frame will not change.

There are two exceptions:

1) If the thread request depth is greater than the stack depth, a StackOverFlowError will be thrown.

2) If the stack cannot request enough memory when dynamically expanding, OOM will be thrown.

3. Heap

The Java heap is shared by all threads. It is created when the virtual machine is started. Stored are instances and arrays of objects. The largest memory occupied. It is divided into the new generation (Young area) and the old generation (Old area). The new generation is divided into Eden area and Servior area. The Servior area is divided into From space area and To space area. The memory ratio between Eden area and Servior area is 8:1. When the extended memory is larger than the available memory, OOM will be thrown.

What are the runtime data areas in JVM

4. Local method stack

The local method stack is exclusive to threads. Similar to the Java virtual machine stack, but instead of serving Java methods (bytecode), it serves native non-Java methods. StackOverFlowError and OOM will also be thrown.

5. Method area

The method area is shared by all threads. Used to store class information, constants, static variables and other data that have been loaded by the virtual machine, also known as Non-Heap. The method area is also called the "permanent generation". GC is rarely performed in this area, but it does not mean that it will not be recycled. The goal of this area recycling is mainly for the recycling of the constant pool and the unloading of types. When the memory request is larger than the actual available memory, OOM will be thrown.

Recommended articles related to java: Getting started with java

The above is the detailed content of What are the runtime data areas in JVM. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:CSDN. If there is any infringement, please contact admin@php.cn delete
一个分布式 JVM 监控工具,非常实用!一个分布式 JVM 监控工具,非常实用!Aug 15, 2023 pm 05:15 PM

该项目为了方便开发者更快监控多个远程主机jvm,如果你的项目是Spring boot那么很方便集成,jar包引入即可,不是Spring boot也不用气馁,你可以快速自行初始化一个Spirng boot程序引入jar包即可

JVM虚拟机的作用及原理解析JVM虚拟机的作用及原理解析Feb 22, 2024 pm 01:54 PM

JVM虚拟机的作用及原理解析简介:JVM(JavaVirtualMachine)虚拟机是Java编程语言的核心组成部分之一,它是Java的最大卖点之一。JVM的作用是将Java源代码编译成字节码,并负责执行这些字节码。本文将介绍JVM的作用及其工作原理,并提供一些代码示例以帮助读者更好地理解。作用:JVM的主要作用是解决了不同平台上Java程序的可移

JVM内存管理要点与注意事项JVM内存管理要点与注意事项Feb 20, 2024 am 10:26 AM

掌握JVM内存使用情况的要点与注意事项JVM(JavaVirtualMachine)是Java应用程序运行的环境,其中最为重要的就是JVM的内存管理。合理地管理JVM内存不仅可以提高应用程序的性能,还可以避免内存泄漏和内存溢出等问题。本文将介绍JVM内存使用的要点和注意事项,并提供一些具体的代码示例。JVM内存分区JVM内存主要分为以下几个区域:堆(He

Java程序检查JVM是32位还是64位Java程序检查JVM是32位还是64位Sep 05, 2023 pm 06:37 PM

在编写java程序来检查JVM是32位还是64位之前,我们先讨论一下JVM。JVM是java虚拟机,负责执行字节码。它是Java运行时环境(JRE)的一部分。我们都知道java是平台无关的,但是JVM是平台相关的。我们需要为每个操作系统提供单独的JVM。如果我们有任何java源代码的字节码,由于JVM,我们可以轻松地在任何平台上运行它。java文件执行的整个过程如下-首先,我们保存扩展名为.java的java源代码,编译器将其转换为扩展名为.class的字节码。这发生在编译时。现在,在运行时,J

Java错误:JVM内存溢出错误,如何处理和避免Java错误:JVM内存溢出错误,如何处理和避免Jun 24, 2023 pm 02:19 PM

Java是一种流行的编程语言,在开发Java应用程序的过程中,可能会遇到JVM内存溢出错误。这种错误通常会导致应用程序崩溃,影响用户体验。本文将探讨JVM内存溢出错误的原因和如何处理和避免这种错误。JVM内存溢出错误是什么?Java虚拟机(JVM)是Java应用程序的运行环境。在JVM中,内存被分为多个区域,其中包括堆、方法区、栈等。堆是用于存储创建的对象的

Linux下Tomcat8怎么修改JVM内存配置Linux下Tomcat8怎么修改JVM内存配置Jun 03, 2023 am 08:43 AM

Tomcat8如何修改JVM内存配置Tomcat并不建议直接在catalina.sh里配置变量,而是写在与catalina同级目录(bin目录)下的setenv.sh里。所以如果我们想要修改jvm的内存配置那么我们就需要修改setenv.sh文件(默认没有,需新建一个setenv.sh),写入(大小根据自己情况修改):exportCATALINA_OPTS="$CATALINA_OPTS-Xms1000m"exportCATALINA_OPTS="$CATALINA

jvm的垃圾回收机制是什么jvm的垃圾回收机制是什么Feb 01, 2023 pm 02:02 PM

jvm的垃圾回收机制是GC(Garbage Collection),也叫垃圾收集器。GC基本原理:将内存中不再被使用的对象进行回收;GC中用于回收的方法称为收集器,由于GC需要消耗一些资源和时间,Java在对对象的生命周期特征进行分析后,按照新生代、老年代的方式来对对象进行收集,以尽可能的缩短GC对应用造成的暂停。

Java错误:JVM分配错误,如何处理和避免Java错误:JVM分配错误,如何处理和避免Jun 25, 2023 pm 06:25 PM

Java是一种广泛使用的编程语言,它在开发大型软件系统中扮演着重要角色。与其他编程语言不同,Java采用了一种独特的内存管理方式,即垃圾回收机制。这种机制可以自动处理内存分配和释放,使得Java在编写程序时会更为方便和舒适。然而,在使用Java时,有时候会遇到JVM分配错误的情况。JVM(JavaVirtualMachine)是Java虚拟机的缩写,是执

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft