Home > Net >  java.lang.OutOfMemoryError: Java heap space in Intellij cannot work even if i change memory space
java.lang.OutOfMemoryError: Java heap space in Intellij cannot work even if i change memory space

Time:06-14

enter image description here

I was just ruined by this error for the whole week. I really don't know what happened, I got this error after compiling the source, I yet write custom code there, the source is fresh from the repo. I asked my friend to run the source and it worked on his laptop.

What I was tried to fix this problem :

  1. File -> Invalidate Cache
  2. Help -> Change Memory Setting (all size was tried) (current size: 2048)
  3. Intellij -> Preference -> Compiler -> Shared Build Process Heap Size (all size was tried) (current size: 6048)

And I am still stuck at that error.

Lately I run this command ./gradlew build --stacktrace --info to see the log, and i had no idea what was that. this is the full result:

enter image description here

enter image description here

enter image description here

CodePudding user response:

You can assign more heap

  • for your ide --> help | change memory settings
  • for your current programm --> Run | Edit Configurations... see screenshot

enter image description here

  • for all programs -->
    • Set Environment Variable: SET _JAVA_OPTIONS=-Xms512m -Xmx2048m
      or
    • File | Settings | Build, Execution, Deployment | Compiler and set user User-local build process VM options with like 2048

enter image description here

Verify heap size with How to view the current heap size that an application is using?

CodePudding user response:

thanks for all your suggestions guys. I've done it all and got the same result.

finally, I can escape from this bug by running this command ./gradlew build in the terminal and close my Intellij. I don't know what really happened, but now it all working perfectly.

I want to ask u guys, I am new in mac, are partitioning disk in mac book take an effect on its performance?

  • Related