实际上,我正在开发 Grails 应用程序,该应用程序运行顺利,但一段时间后它抛出异常:java.lang.OutOfMemoryError:Java堆空间
为此,我收到了一些解决方案,例如
添加环境。变量
GRAILS_OPTS = -server -Xms512m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m
甚至尝试GRAILS_OPTS = -Xms512m -Xmx1024m
将变量
JAVA_OPTS=-Xmx1024m -XX:MaxPermSize=96m
添加到 startGrails.bat 文件正在 .bashrc 文件中添加
export GRAILS_OPTS="-Xms1g -Xmx1g -server"
任何人都可以告诉我这个文件位于哪里。
选项 1 和 2 都不行。
使用Windows 10
最佳答案
When an interactive shell that is not a login shell is started, bash reads and executes commands from ~/.bashrc, if that file exists. This may be inhibited by using the --norc option. The --rcfile file option will force bash to read and execute commands from file instead of ~/.bashrc.
这是一个隐藏文件(请注意点作为第一个字符),因此请使用以下命令在终端中打开它(如果您使用的是 gedit ofc):
sudo gedit ~/.bashrc
更新:但是,在再次阅读您的问题后,我认为您正在 Windows 上工作,并且您的选项 3 是 #1 的 Linux 替代方案。不是吗?
关于java - Windows - 在哪里找到 .bashrc 文件以增加堆大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34722347/