当前位置:网站首页>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
边栏推荐
- Python saves the list data
- Discussion on the development practice of aspnetcore, a cross platform framework
- Read the advantages of Wi Fi 6 over Wi Fi 5 in 3 minutes
- For a while, a dynamic thread pool was created, and the source code was put into GitHub
- 一篇文章带你了解CSS3 背景知识
- Introduction to X Window System
- 前端工程师需要懂的前端面试题(c s s方面)总结(二)
- [actual combat of flutter] pubspec.yaml Configuration file details
- Who says cat can't do link tracking? Stand up for me
- The AI method put forward by China has more and more influence. Tianda et al. Mined the development law of AI from a large number of literatures
猜你喜欢
FastThreadLocal 是什么鬼?吊打 ThreadLocal 的存在!!
这个项目可以让你在几分钟快速了解某个编程语言
一篇文章教会你使用Python网络爬虫下载酷狗音乐
Free patent download tutorial (HowNet, Espacenet)
Flink的DataSource三部曲之一:直接API
Three Python tips for reading, creating and running multiple files
文件过多时ls命令为什么会卡住?
DRF JWT authentication module and self customization
新建一个空文件占用多少磁盘空间?
Even liver three all night, jvm77 high frequency interview questions detailed analysis, this?
随机推荐
Elasticsearch数据库 | Elasticsearch-7.5.0应用搭建实战
Basic principle and application of iptables
It is really necessary to build a distributed ID generation service
Analysis of query intention recognition
一篇文章教会你使用Python网络爬虫下载酷狗音乐
一篇文章带你了解CSS对齐方式
Who says cat can't do link tracking? Stand up for me
keras model.compile Loss function and optimizer
快速排序为什么这么快?
Analysis of ThreadLocal principle
Interpretation of Cocos creator source code: engine start and main loop
Wechat applet: prevent multiple click jump (function throttling)
5.5 controlleradvice notes - SSM in depth analysis and project practice
StickEngine-架构11-消息队列(MessageQueue)
Pattern matching: The gestalt approach一种序列的文本相似度方法
Analysis of partial source codes of qthread
How to get started with new HTML5 (2)
Flink的DataSource三部曲之一:直接API
FastThreadLocal 是什么鬼?吊打 ThreadLocal 的存在!!
Brief introduction of TF flags