如何为 Netbeans 分配更多内存? [英] How to assign more memory to Netbeans?
问题描述
我的 PC 上有 24 GB 的 RAM,但有时当 Netbeans 编译我的项目时,它说没有足够的内存来编译它,我查看了内存使用情况,它显示:586/590 M.
那么如何告诉 Netbeans,有足够的 RAM,可以根据需要使用多少?
在您的 Netbeans-Home 下的 etc 目录中,编辑文件 netbeans.conf 文件.-Xms 和 -Xmx 应该增加到允许您的程序编译的值.
以下是 netbeans.conf 中的说明:
# 注意默认的 -Xmx 和 -XX:MaxPermSize 是自动为你选择的.# 你可以在你的用户目录中的 var/log/messages.log 文件中找到这些值.# 自动选择的值可以通过指定 -J-Xmx 或# -J-XX:MaxPermSize= 此处或在命令行上.
将值放入 netbeans_default_options 字符串中.这是我的(删除换行符,为了可读性而添加):
netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-XX:PermSize=32m-J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true-J-Dsun.java2d.noddraw=true -J-Dsun.java2d.dpiaware=true-J-Dsun.zip.disableMemoryMapping=true -J-Dsun.awt.disableMixing=true-J-Dswing.aatext=true -J-Dawt.useSystemAAFontSettings=lcd --laf Nimbus"
-J-Xms
设置最小 Java 堆大小,-J-Xmx
设置最大 Java 堆大小.>
I have 24 GB of RAM on my PC, but sometimes when Netbeans compiles my projects, it says not enough memory to compile it, I looked at the memory useage, it shows : 586/590 M.
So how to tell Netbeans, there are plenty of RAM, use as much as you need ?
In the etc directory under your Netbeans-Home, edit the file netbeans.conf file. -Xms and -Xmx should be increased to the values that allow your program to compile.
Here are the instructions in netbeans.conf:
# Note that default -Xmx and -XX:MaxPermSize are selected for you automatically.
# You can find these values in var/log/messages.log file in your userdir.
# The automatically selected value can be overridden by specifying -J-Xmx or
# -J-XX:MaxPermSize= here or on the command line.
Put the values in the netbeans_default_options string. Here is mine (remove linebreaks, added for readability):
netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-XX:PermSize=32m
-J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true
-J-Dsun.java2d.noddraw=true -J-Dsun.java2d.dpiaware=true
-J-Dsun.zip.disableMemoryMapping=true -J-Dsun.awt.disableMixing=true
-J-Dswing.aatext=true -J-Dawt.useSystemAAFontSettings=lcd --laf Nimbus"
EDIT: -J-Xms
sets the minimum Java heap size, -J-Xmx
sets the maximum Java heap size.
这篇关于如何为 Netbeans 分配更多内存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!