简体   繁体   English

如何将JVM的内存大小增加到1GB以上

[英]How to increase memory size for JVM beyond 1gb

When I try to set -Xms and -Xmx values more than 1gb, I am getting an error: 当我尝试将-Xms-Xmx值设置为大于1gb时,我收到一个错误:

Error occurred during initialization of VM VM初始化期间发生错误

My pc has 8GB of RAM. 我的电脑有8GB的RAM。

I need to hold and manipulate a huge amount of data in memory. 我需要在内存中保存和操作大量数据。

A 32-bit JVM can have a maximum heap size of at most 4GB - in some systems it's less due to various technical reasons (such as the need for contiguous memory). 32位JVM的最大堆大小最多为4GB - 在某些系统中,由于各种技术原因(例如需要连续内存),它的数量较少。 Try using a 64-bit version, assuming you're on a 64-bit machine. 尝试使用64位版本,假设您使用的是64位计算机。

The reason for this is that the maximum number of addresses that you can point to with 32 bits is 2^32, which is 4GB. 原因是32位的最大地址数是2 ^ 32,即4GB。 This theoretical maximum can never really be accessed by the user as it is needed by the JVM for Klass files (the internal representation of your code) and other stuff. 这个理论上的最大值永远不会被用户真正访问,因为JVM需要Klass文件(代码的内部表示)和其他东西。

Also see this question . 另见这个问题

如果您使用的是64位操作系统,那么真正的解决方案是添加-d64以强制它以64位运行,因此分配4GB。

i would definitely suggest you to go thru article 我肯定会建议你去通过文章

http://javarevisited.blogspot.in/2013/04/what-is-maximum-heap-size-for-32-bit-64-JVM-Java-memory.html http://javarevisited.blogspot.in/2013/04/what-is-maximum-heap-size-for-32-bit-64-JVM-Java-memory.html

Apart from Ram, xmx paramters also depends on parameters like os,jvm bit etc. 除了Ram之外,xmx参数还依赖于os,jvm bit等参数。

Also would suggest you to ahve statistics to determine how much free memory is there. 还建议你通过统计来确定有多少可用内存。 See http://viralpatel.net/blogs/getting-jvm-heap-size-used-memory-total-memory-using-java-runtime/ to determine how much meory is in use and free memory. 请参阅http://viralpatel.net/blogs/getting-jvm-heap-size-used-memory-total-memory-using-java-runtime/以确定使用的内存量和可用内存量。

To have best utilization it should be both ie 64 bit os and 64 bit bit vm 为了获得最佳利用率,它应该是64位操作系统和64位位vm

On 32-bit editions of Windows, applications have 4 gigabyte (GB) of virtual address space available. 在32位版本的Windows上,应用程序具有4千兆字节(GB)的虚拟地址空间。 The virtual address space is divided so that 2-GB is available to the application and the other 2-GB is available only to the system.See http://msdn.microsoft.com/en-us/library/Aa366521 虚拟地址空间被划分,以便应用程序可以使用2 GB,而另一个2 GB仅可用于系统。请参阅http://msdn.microsoft.com/en-us/library/Aa366521

so make sure you have enough memory(whatever you are mentioning against params xms and xmx) with the program i mentioned above 因此,请确保您有足够的内存(无论您提到的反对params xms和xmx)与上面提到的程序

IMHO it's about the same problem with slight difference in question.. 恕我直言,这是一个相同的问题,问题略有不同..

Eclipse memory allocation problem Eclipse内存分配问题

As you can see Java Runtime Environment are set in Java Control Panel. 如您所见,Java Runtime Environment在Java控制面板中设置。 Try to add Runtime parameter eg -Xmx3072m in Runtime Parameter's column. 尝试在运行时参数列中添加运行时参数,例如-Xmx3072m

Or perhaps you could check this article out.. 或许你可以查看这篇文章..

How to Increase Java Memory in Windows 7 如何在Windows 7中增加Java内存

Hope it's help solving the problem... 希望它有助于解决问题......

Regards, Ivan 此致,伊万

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM