1

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

4
  • 1
    Try to add gradle.properties file in the project root directory (next to build.gradle) and add the following there: org.gradle.jvmargs=-Xms512m -Xmx4g Commented Jun 13, 2022 at 7:17
  • 1
    Did the execution generate a heap dump? If so, you might want to analyze it with a tool like Eclipse Memory Analyzer. Commented Jun 13, 2022 at 20:40
  • Did you verify your used heap size? Commented Jun 14, 2022 at 9:12
  • 1
    Changing Intellij -> Preference -> Compiler -> Shared Build Process Heap Size in case of same error on Scala with SBT helped! Commented Mar 10, 2023 at 21:57

3 Answers 3

5

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?

Sign up to request clarification or add additional context in comments.

Comments

1

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?

1 Comment

Hello Arma, that is a not perfect solution but it works right. I would let you know that you can just edit your question or comment on it to make it more clear to reader the soulion you've taken.
0

I faced the same issue and spend a few hours attempting to understand the root cause. I have tried to change the memory limits as suggested above. Simply put, I have tried everything, but it didn't help me.

Then I got an idea that I should try to run another test and bingo! It worked as usual. Then I decided to rewrite the "problematic" test from scratch. During rewriting I caught myself thinking that I forgot to mock/define some dependencies of the class under testing.

Recently, I added Clock to my class

private final Clock clock;

After defining this dependency in the test class the issue has gone

var clock = Clock.fixed(Instant.now(), ZoneOffset.UTC);

I see that the question was asked a couple of years ago, but I believe it could be useful for someone.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.