java堆空间是由RAM还是硬盘决定的? [英] Is java heap space dictated by RAM or hard drive?

查看:192
本文介绍了java堆空间是由RAM还是硬盘决定的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在执行一个巨大的计算,我得到一个堆外空间错误。我想知道的是,如果Java自动进行分页,那么在执行此计算时可能会使用我的硬盘空间吗?如果没有自动执行此操作,如何启用此选项?

I'm performing a huge calculation and I'm getting a "out of heap space" error. What I'm wondering is if Java does paging automatically, so that maybe my hard drive space can be used when performing this calculation? If it doesn't do it automatically, how do I turn this option on?

推荐答案

Java堆存在于RAM中(忽略虚拟内存 :)。您可以使用 <$ c $更改默认初始堆大小和最大堆大小c> -Xms 和 -Xmx VM args

The Java heap lives in RAM (ignoring virtual memory :). You can change the default initial heap size and maximum heap size with the -Xms and -Xmx VM args, respectively.


旧的一代默认堆大小可以通过使用-Xms和-Xmx开关分别指定初始和最大大小来覆盖:

The old generation, default heap size can be overridden by using the -Xms and -Xmx switches to specify the initial and maximum sizes respectively:

java -Xms <initial size> -Xmx <maximum size> program

例如:

java -Xms128m -Xmx512m application







您的机器有多少内存?您认为需要更多堆的计算是什么类型的计算?


How much RAM does your machine have? Just what sort of a calculation is this that you think you need more heap than that?

这篇关于java堆空间是由RAM还是硬盘决定的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆