当前位置: 首页 > news >正文

JVM-JVM内存结构(一)

程序计数器

Program Counter Register程序计数器(寄存器)

程序计数器在物理层上是通过寄存器实现的

  • 作用:记住下一条jvm指令的执行地址
  • 特点
    1. 是线程私有的(每个线程都有属于自己的程序计数器)
    2. 不会存在内存溢出

虚拟机栈

  • 每个线程运行时所需要的内存称为虚拟机栈
  • 每个栈由多个栈帧组成,对应着每次方法调用时所占的内存
  • 每个线程只能有一个活动栈帧,对应着当前正在执行的那个方法

栈内存溢出(StackOverflowError)

  • 栈帧过多导致内存溢出
  • 栈帧过大导致内存溢出

java编译工具:

jstack 线程id:可以根据线程id找到有问题的线程进一步定位到有问题的代码行数

本地方法栈(Native Method stack)

java代码在完成一些需求时,需要调用一些底层的,如c/c++代码,那么就需要本地方法栈

例如hashCode()方法,就是一个本地方法

public native int hashCode();/*** Indicates whether some other object is "equal to" this one.* <p>* The {@code equals} method implements an equivalence relation* on non-null object references:* <ul>* <li>It is <i>reflexive</i>: for any non-null reference value*     {@code x}, {@code x.equals(x)} should return*     {@code true}.* <li>It is <i>symmetric</i>: for any non-null reference values*     {@code x} and {@code y}, {@code x.equals(y)}*     should return {@code true} if and only if*     {@code y.equals(x)} returns {@code true}.* <li>It is <i>transitive</i>: for any non-null reference values*     {@code x}, {@code y}, and {@code z}, if*     {@code x.equals(y)} returns {@code true} and*     {@code y.equals(z)} returns {@code true}, then*     {@code x.equals(z)} should return {@code true}.* <li>It is <i>consistent</i>: for any non-null reference values*     {@code x} and {@code y}, multiple invocations of*     {@code x.equals(y)} consistently return {@code true}*     or consistently return {@code false}, provided no*     information used in {@code equals} comparisons on the*     objects is modified.* <li>For any non-null reference value {@code x},*     {@code x.equals(null)} should return {@code false}.* </ul>** <p>* An equivalence relation partitions the elements it operates on* into <i>equivalence classes</i>; all the members of an* equivalence class are equal to each other. Members of an* equivalence class are substitutable for each other, at least* for some purposes.** @implSpec* The {@code equals} method for class {@code Object} implements* the most discriminating possible equivalence relation on objects;* that is, for any non-null reference values {@code x} and* {@code y}, this method returns {@code true} if and only* if {@code x} and {@code y} refer to the same object* ({@code x == y} has the value {@code true}).** In other words, under the reference equality equivalence* relation, each equivalence class only has a single element.** @apiNote* It is generally necessary to override the {@link #hashCode() hashCode}* method whenever this method is overridden, so as to maintain the* general contract for the {@code hashCode} method, which states* that equal objects must have equal hash codes.** @param   obj   the reference object with which to compare.* @return  {@code true} if this object is the same as the obj*          argument; {@code false} otherwise.* @see     #hashCode()* @see     java.util.HashMap*/
http://www.lryc.cn/news/294710.html

相关文章:

  • React Emotion 如何优雅的使用样式(一)
  • 1+X运维试题样卷A卷(初级)
  • QT QDialog 中的按钮,如何按下后触发 accepted 消息?
  • seata分布式事务
  • Python HttpServer 之 简单快速搭建本地服务器,并且使用 requests 测试访问下载服务器文件
  • 【Python 实战】---- 实现批量给 pdf 插入 excel 动态生成的印章
  • 51单片机实验课二
  • 1-4 动手学深度学习v2-线性回归的简洁实现-笔记
  • SQL如何实现数据表行转列、列转行?
  • 【React】redux状态管理、react-redux状态管理高级封装模块化
  • HAProxy 和负载均衡概念简介
  • 【go】ent操作之CRUD与联表查询
  • 服务器性能监控管理方法及工具
  • AUTOSAR汽车电子嵌入式编程精讲300篇-基于FPGA和CAN协议2.0B的总线控制器研究与设计
  • 14.1 Ajax与JSON应用(❤❤)
  • ffmpeg命令生成器
  • JavaScript基础速成
  • openGauss学习笔记-215 openGauss性能调优-确定性能调优范围-性能日志
  • 在vs code的terminal,debug执行python main.py --train True
  • docker 简单项目
  • 计算机毕业设计 基于SpringBoot的线上教育培训办公系统的设计与实现 Java实战项目 附源码+文档+视频讲解
  • 四、机器学习基础概念介绍
  • Excel设置单元格下拉框(poi)
  • api接口是什么意思,api接口该如何防护呢?
  • PMP资料怎么学?PMP备考经验分享
  • partition by list(msn_id)子句的含义
  • 【C++】I/O多路转接详解(二)
  • PySpark(三)RDD持久化、共享变量、Spark内核制度,Spark Shuffle
  • 详解MYSQL中的平均值组大小
  • 【爬虫专区】批量下载PDF (无反爬)