Android Studio设置内存大小

参考:

http://blog.csdn.net/xyxjn/article/details/46906909

http://stackoverflow.com/questions/27367071/android-studio-1-0-failing-build-at-dexdebug-or-dexrelease


Android studio 1.0.2默认最大内存是750M,这样跑起来非常的卡,难以忍受,机器又不是固态硬盘,最后发现,这个默认值是可以修改的,在android studio目录下找到:studio64.exe.vmoptions文件,绿色部分为修改的参数(-Xmx1050m),将默认参数修改为1050MB,这样跑起来就非常流畅了,如果觉得还是不够流畅,可以改得更高:


默认值:-Xmx750m

#-Xmx750m
#-Xmx4096m
-Xmx2048m

http://stackoverflow.com方案:

studio64.exe.vmoptions文件

-Xms256m -Xmx1024m -XX:MaxPermSize=350m -XX:ReservedCodeCacheSize=96m -XX:+UseCompressedOops
或者

as per suggested from answers in Android Studio - How to increase Allocated Heap Size

Additionally you may want to add

dexOptions { javaMaxHeapSize "4g" }


我本机的文件studio64.exe.vmoptions

#
# *DO NOT* modify this file directly. If there is a value that you would like to override,
# please add it to your user specific configuration file.
#
# See http://tools.android.com/tech-docs/configuration
#
-Xms256m
-Xmx1280m
-XX:MaxPermSize=350m
-XX:ReservedCodeCacheSize=225m
-XX:+UseConcMarkSweepGC
-XX:SoftRefLRUPolicyMSPerMB=50
-da
-Djna.nosys=true
-Djna.boot.library.path=

-Djna.debug_load=true
-Djna.debug_load.jna=true
-Dsun.io.useCanonCaches=false
-Djava.net.preferIPv4Stack=true
-Didea.paths.selector=AndroidStudio1.5
-Didea.platform.prefix=AndroidStudio


你可能感兴趣的:(Android Studio设置内存大小)