在Eclipse中增加Java堆大小 - 使用虚拟内存 [英] Increasing Java heap size in Eclipse - using virtual memory

查看:142
本文介绍了在Eclipse中增加Java堆大小 - 使用虚拟内存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Eclipse(Windows)中运行一个程序,需要一个比较大的内存大小。将 -Xmx1500m 传递给程序似乎不够,而Eclipse不允许我分配更大的值。有了这个配置,我得到了超出内存的异常。
我将虚拟内存大小增加到 40GB 。是不是有办法使这个内存可用于我的程序?我很容易在C#中完成这个工作,几乎是同一份工作。

解决方案

你需要运行一个 64Bit vm 允许超过大约-Xmx1500m



您可以在程序的运行设置中指定,而不需要应用它在eclipse.ini中,这是为了eclipse本身。但是,与系统中的真实(物理,免费)内存相比,给java-vm更多的内存不是一个好主意,因为GC将会走通过许多区域的内存,当它运行,并将导致读/写内存从/到磁盘 - 意味着交换。而这又会导致非常糟糕的表现。在这种情况下,您应该考虑消耗内存的情况,以及是否有一种外部管理数据的方法 - 在磁盘或一些MemoryBuffers上。


I am running a program in Eclipse(Windows) and need a relatively huge size of memory. Passing the -Xmx1500m to the program seems not sufficient, while Eclipse does not permit me to assign a greater value. Having this configuration I get the out-of-memory exception. I increased the virtual memory size to 40GB. Isn't there a way to make this memory available to my program? I had easily done this in C#, for almost the same job.

解决方案

you need to run a 64Bit vm to allow more than around -Xmx1500m

You may specify that in the Run-Settings for your program and do not need to apply it in the eclipse.ini which is for eclipse itself.

BUT: it is not a good idea to give the java-vm more memory than the real (physical, free) memory on your system is, because the GC will walk through many areas of the memory when it runs and that will lead to reading/writing memory from/to disk - means swapping. And this again will lead to a very bad performance. In this case you should think about what is consuming the memory and if there is a way to manage this data externally - on disk or some MemoryBuffers.

这篇关于在Eclipse中增加Java堆大小 - 使用虚拟内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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