当前位置:网站首页>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
边栏推荐
- Wow, elasticsearch multi field weight sorting can play like this
- Pattern matching: The gestalt approach一种序列的文本相似度方法
- A brief history of neural networks
- vue-codemirror基本用法:实现搜索功能、代码折叠功能、获取编辑器值及时验证
- Analysis of partial source codes of qthread
- Basic principle and application of iptables
- Chainlink brings us election results into blockchain everipedia
- TensorFlow中的Tensor是什么?
- Solve the problem of database insert data garbled in PL / SQL developer
- Asp.Net Core learning notes: Introduction
猜你喜欢

零基础打造一款属于自己的网页搜索引擎

Jetcache buried some of the operation, you can't accept it

前端工程师需要懂的前端面试题(c s s方面)总结(二)

零基础打造一款属于自己的网页搜索引擎

一篇文章教会你使用Python网络爬虫下载酷狗音乐

(1) ASP.NET Introduction to core3.1 Ocelot

Discussion on the technical scheme of text de duplication (1)

What are Devops

axios学习笔记(二):轻松弄懂XHR的使用及如何封装简易axios

A course on word embedding
随机推荐
[C] (original) step by step teach you to customize the control element - 04, ProgressBar (progress bar)
ES6学习笔记(四):教你轻松搞懂ES6的新增语法
DRF JWT authentication module and self customization
Construction of encoder decoder model with keras LSTM
Advanced Vue component pattern (3)
DC-1靶機
From zero learning artificial intelligence, open the road of career planning!
新建一个空文件占用多少磁盘空间?
一篇文章带你了解CSS对齐方式
With the advent of tensorflow 2.0, can pytoch still shake the status of big brother?
It's time for your financial report to change to a more advanced style -- financial analysis cockpit
Behind the first lane level navigation in the industry
Wechat applet: prevent multiple click jump (function throttling)
If PPT is drawn like this, can the defense of work report be passed?
axios学习笔记(二):轻松弄懂XHR的使用及如何封装简易axios
前端工程师需要懂的前端面试题(c s s方面)总结(二)
Wow, elasticsearch multi field weight sorting can play like this
Who says cat can't do link tracking? Stand up for me
NLP model Bert: from introduction to mastery (2)
零基础打造一款属于自己的网页搜索引擎