当前位置:网站首页>JVM内存分配 -Xms128m -Xmx512m -XX:PermSize=128m -XX:MaxPermSize=512m
JVM内存分配 -Xms128m -Xmx512m -XX:PermSize=128m -XX:MaxPermSize=512m
2020-11-06 21:19:00 【天机玄正】
在linux环境下配置项目运行环境时,部署的人员都会分配一下内存,以保证程序正常的运行。其实在开发的时候(window系统),就已经涉及到内存分配了,只是这些参数有默认值,因此一直没有去重视它。
以Myeclipse为例,在Preferences->Java->Installed JREs下面,就有设置jvm内存分配。
这里我们就可以配置内存,一般我们见到的都是
-Xms128m -Xmx512m -XX:PermSize=128m -XX:MaxPermSize=512m
linux中一般为:
-vmargs -Xms128m -Xmx512m -XX:PermSize=128m -XX:MaxPermSize=512m
但是这一串究竟是什么意思,这里就给大家讲解一下。
按照官方的说法:Java 虚拟机具有一个堆(Heap),堆是运行时数据区域,所有类实例和数组的内存均从此处分配。堆是在 Java 虚拟机启动时创建的,在JVM中堆之外的内存称为非堆内存(Non-heap memory)。
简单的说就是:堆是java代码可及的内存,开发人员写的东西都是堆分配的内存(底层实现除外)。而非堆内存则是JVM自己用的,比如JVM内部处理或优化,垃圾处理,常数池等。
堆的内存分配用-Xms和-Xmx
-Xms分配堆最小内存,默认为物理内存的1/64;-Xmx分配最大内存,默认为物理内存的1/4。
非堆内存分配用-XX:PermSize和-XX:MaxPermSize
-XX:PermSize分配非堆最小内存,默认为物理内存的1/64;-XX:MaxPermSize分配非堆最大内存,默认为物理内存的1/4。
因此,合理的内存分配是程序正常稳定的运行的基础。不然内存溢出可就麻烦了。
版权声明
本文为[天机玄正]所创,转载请带上原文链接,感谢
https://my.oschina.net/sijiacheng/blog/4557406
边栏推荐
- 零基础打造一款属于自己的网页搜索引擎
- It's easy to operate. ThreadLocal can also be used as a cache
- Elasticsearch数据库 | Elasticsearch-7.5.0应用搭建实战
- Construction of encoder decoder model with keras LSTM
- 前端未來趨勢之原生API:Web Components
- Cglib 如何实现多重代理?
- The dynamic thread pool in Kitty supports Nacos and Apollo multi configuration centers
- Analysis of partial source codes of qthread
- ES6学习笔记(四):教你轻松搞懂ES6的新增语法
- Even liver three all night, jvm77 high frequency interview questions detailed analysis, this?
猜你喜欢
一篇文章带你了解CSS3图片边框
A course on word embedding
What are manufacturing and new automation technologies?
How to customize sorting for pandas dataframe
FastThreadLocal 是什么鬼?吊打 ThreadLocal 的存在!!
给字节的学姐讲如何准备“系统设计面试”
小游戏云开发入门
C#和C/C++混合编程系列5-内存管理之GC协同
NLP model Bert: from introduction to mastery (1)
仅用六种字符来完成Hello World,你能做到吗?
随机推荐
一路踩坑,被迫聊聊 C# 代码调试技巧和远程调试
用一个例子理解JS函数的底层处理机制
For a while, a dynamic thread pool was created, and the source code was put into GitHub
MeterSphere开发者手册
快速排序为什么这么快?
Wow, elasticsearch multi field weight sorting can play like this
Basic usage of GDB debugging
Natural language processing - BM25 commonly used in search
Unity性能优化整理
Azure data factory (3) integrate azure Devops to realize CI / CD
Mongodb (from 0 to 1), 11 days mongodb primary to intermediate advanced secret
Construction of encoder decoder model with keras LSTM
If PPT is drawn like this, can the defense of work report be passed?
NLP model Bert: from introduction to mastery (2)
What if the front end doesn't use spa? - Hacker News
Our best practices for writing react components
Live broadcast preview | micro service architecture Learning Series live broadcast phase 3
Word segmentation, naming subject recognition, part of speech and grammatical analysis in natural language processing
零基础打造一款属于自己的网页搜索引擎
Discussion on the development practice of aspnetcore, a cross platform framework