如何启动具有无限内存的JVM? [英] How do I start a JVM with unlimited memory?

查看:154
本文介绍了如何启动具有无限内存的JVM?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何启动没有堆最大内存限制的JVM?这样它可以占用尽可能多的内存?

How do I start a JVM with no heap max memory restriction? So that it can take as much memory as it can ?

我搜索了是否有这样的选项,但是我似乎只找到-Xmx和-Xms选项.

I searched if there is such an option, but I only seem to find the -Xmx and -Xms options.

假设我有一台具有4GB RAM的服务器,并且该服务器仅运行我的应用程序.而且,假设我有一台具有32GB RAM的服务器.我不想以4GB的内存限制启动我的应用程序,因为第二台机器应该可以处理更多对象

Let's say I have a server with 4GB of RAM and it only runs my application. And, let's say I have another server with 32GB of RAM. I don't want to start my application with 4GB of memory limit because the second machine should be able to handle more objects

推荐答案

您不能(或者至少我不知道支持它的JVM实现). JVM在启动时需要知道可以分配多少内存,以确保可以在虚拟内存中保留连续范围.除其他外,这使内存管理中的推理更简单.

You can't (or at least, I don't know a JVM implementation that supports it). The JVM needs to know at start up how much memory it can allocate, to ensure that it can reserve a contiguous range in virtual memory. This allows - among others - for simpler reasoning in memory management.

如果在运行时扩展虚拟内存,则可能导致虚拟内存范围碎片化,从而使跟踪和引用内存更加困难.

If virtual memory would be expanded at runtime, this could lead to fragmented virtual memory ranges, making tracking and referencing memory harder.

这篇关于如何启动具有无限内存的JVM?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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