Android Studio Out of Memory

前端 未结 6 1870
被撕碎了的回忆
被撕碎了的回忆 2020-12-02 21:23

This morning I have been experiencing an issue with Android Studio, whenever I open it I am getting the following error.<script

相关标签:
6条回答
  • 2020-12-02 21:43

    I also got the same problem in my case, I tried to dump memory and it is reached to 200mb and while opening the studio it is showing the continuous process, because of '.hprof' the file is loading. Finally, I removed the '.hprof' and able to run my project. The .'hprof' file removed from the directory ''

    0 讨论(0)
  • 2020-12-02 21:47

    I had the same error recently (Android studio 3) even though I had 16gb Ram + I7700K CPU. I noticed that it started to appear after I disabled the Virtual Memory Ram because I needed some extra space in my SSD. so I just reactivated it and the problem was solved!

    0 讨论(0)
  • 2020-12-02 21:52

    There are couple of ways to handle out of memory in Android Studio:

    1. Clean the Project And Rebuild
    2. Invalidate Caches/Restart -> Sync Project with Gradle files
    3. Restart the PC
    4. Close Android Studio -> Delete .idea folder -> Start the Android Studio and rebuild.
    5. Still facing the issue, Need proper investigation.
    0 讨论(0)
  • 2020-12-02 21:52

    This happened to me when I entered /* to begin commenting out a few lines. And it happened before I could add the */ to close the comment section. Therefore, the entire second half of the file (and beyond) was being commented out. I could not go back to add the needed */ to close the comment, because the "Out of Memory" window kept popping back up before I could do so.

    So I closed Android Studio, opened the same .java file in NotePad, added the needed * / a few lines below the /*, saved the file with NotePad, then reopened it again in Android Studio.

    The Out of Memory problem was gone for good.

    0 讨论(0)
  • Go to /Applications and do right click on Android Studio > show package contents Then go to /Contents/bin/studio.vmoptions and change it like this:

    -Xms128m

    -Xmx800m

    -XX:MaxPermSize=350m

    -XX:ReservedCodeCacheSize=96m

    -XX:+UseCompressedOops

    0 讨论(0)
  • 2020-12-02 22:01

    I was fighting with this problem today for a few hours and ended up trying File -> Invalidate Caches / Restart... and chose the Invalidate/Restart option. Seems to have fixed the Out of Memory error.

    Don't know if that will work for you at a later time, but hopefully it helps.

    0 讨论(0)
提交回复
热议问题