【问题标题】:Increase default max heap space in Eclipse增加 Eclipse 中的默认最大堆空间
【发布时间】:2019-06-24 08:15:56
【问题描述】:

如何更改 Eclipse (ubuntu 18) 中运行的所有程序的最大 Java 堆大小的默认值?

(我的意思是没有为每个入口点设置脚本参数)

我也不完全确定 Runtime.getRuntime().maxMemory() 给出真正的价值..

我什至在eclipse.ini 中添加了那些似乎被忽略的行

-Xms256m
-Xmx4G

建议的副本没有回答我的问题

【问题讨论】:

    标签: java eclipse


    【解决方案1】:

    您可以在首选项中为用于运行 Java 应用程序的 JVM 设置默认参数。转到“Java > 已安装的 JRE”页面。选择您正在使用的 JRE/JDK 并单击“编辑...”按钮。在编辑对话框中有一个“默认 VM 参数”字段,您可以在其中放置您的设置。

    注意:eclipse.ini 行仅更改 Eclipse 本身的设置,它们与从 Eclipse 运行 Java 应用程序无关。

    【讨论】:

    • 谢谢,Eclipse 本身和 Java 应用程序之间没有任何关系?
    • @alfredopacino 根本没有。 eclipse.ini 设置仅更改用于运行 Eclipse 的 JVM 的设置。用于运行程序的 JVM 是完全独立的,甚至不必是相同版本的 Java。
    【解决方案2】:

    以下是在 Eclipse 中增加 JVM 堆大小的步骤:

    第 1 步

    Open Eclipse and in the toolbar menu, go to Run -> Run Configurations
    

    第 2 步

    In the left pane of Run Configurations window, navigate to the Java Application node and select the Java application for which you need to increase the heap size. Then in the right pane, click on the Arguments tab.
    

    例如,

    -Xms256M – JVM will start with an initial memory size of 256 MB
    -Xmx512M – and can use up to a maximum of 512 MB .
    

    【讨论】:

    • 谢谢,但这些步骤只增加了单个应用程序的内存。问题是关于如何增加默认值。
    猜你喜欢
    • 2013-01-01
    • 2012-01-25
    • 1970-01-01
    • 1970-01-01
    • 2014-07-13
    • 1970-01-01
    • 2011-01-14
    • 1970-01-01
    相关资源
    最近更新 更多