Android的工作室 - 如何提高分配的堆大小分配、大小、工作室、Android

2023-09-12 00:32:48 作者:天然呆的孩纸

我一直在使用的Andr​​oid工作室3个月了,我开始它已经成为相当大的应用程序之一。在程序的右下角标明了内存使用情况说,我堆分配刷爆在494M。

I've been using Android Studio for 3 months now and one of the apps I started on it has become fairly large. The memory usage indicated at the bottom right of the program says my allocated heap is maxed at 494M.

当我开始改变的XML文件我的内存使用量迅速达到这一上限和IDE崩溃与内存不足的错误是这样的。

When I start to change the XML files my memory usage quickly reaches that cap and the IDE crashes with an Out Of Memory error like this.

我试图以此来增加堆大小,但至今一直没有效果。

I've tried to increase the heap size using this but so far there has been no effect.

我已经看了许多文章,并就如何增加堆大小的其他问题,但没有他们的答案都在工作。无论我做什么的VMOPTIONS或IDE设置堆的大小不增加。我相信我是编辑工作的正确文件为VMOPTIONS因为如果我故意给它一个无效的命令机器人工作室抱怨它并没有启动。

I've looked at dozens of articles and other questions on how to increase the heap size but none of their answers are working. No matter what I do to the VMOPTIONS or the IDE settings the heap size never increases. I believe I am editting the correct file for the VMOPTIONS because if I purposely give it an invalid command Android Studio complains about it and doesn't start.

我使用Windows 7 - 64位,并有16GB内存。 任何人都有这个问题,Android的工作室?而且是你能解决这个问题?

I'm using windows 7 - 64 bit and have 16GB RAM. Has anyone else had this problem with Android Studio? And were you able to fix it?

推荐答案

我看了看我的环境变量,并呼吁一个系统变量 _JAVA_OPTIONS 的值 -Xms256m -Xmx512m ,改变这 -Xms256m -Xmx1024m 最大堆大小相应增加。

I looked at my Environment Variables and had a System Variable called _JAVA_OPTIONS with the value -Xms256m -Xmx512m, after changing this to -Xms256m -Xmx1024m the max heap size increased accordingly.