解決方案:
Go toC:\Program Files\Android\Android Studio\bin\studio.exe.vmoptions
Open it with notepad. some times it will not be editable so give administrative permission and change the following attributes:
-Xmx512mto-Xmx256m
-XX:MaxPermSize=250mto-XX:MaxPermSize=128m
Or change:
-Xmx750mto-Xmx512m
-XX:MaxPermSize=350mto-XX:MaxPermSize=250m