When I tried to unit test with IntelliJ, I was told "java.lang.OutOfMemoryError: Java heap space"

What happened

スクリーンショット 2021-01-05 14.59.43.png One day I tried to unit test java with intellij. .. ..

java.lang.OutOfMemoryError:

The error is ... When I looked it up, there was some information, but I was addicted to it, so I will leave a countermeasure as a memorandum.

What i did

This time I did two methods

The first

Menu bar> IntelliJ IED> Preferences> Compiler Added -Xmx2048m toShared build process VM options: スクリーンショット 2021-01-05 15.05.28.png This is the method that I have investigated and found the most.

The second

スクリーンショット 2021-01-05 15.09.24.png Select Modify Run Configuration at the bottom from the run button of unit test スクリーンショット 2021-01-05 15.09.41.png A screen like this will appear, so put -Xmx2048m in the VM options here and apply

Summary

When I was investigating, it seemed that there were many people who solved it with the first method, but for some reason I could not solve it without the second method, so if anyone can help I'm happy

References

https://stackoverrun.com/ja/q/7802559 https://www.366service.com/jp/qa/986b19e266eaaafb99b2f2ccddd3378c

Recommended Posts

When I tried to unit test with IntelliJ, I was told "java.lang.OutOfMemoryError: Java heap space"
I tried to interact with Java
I tried to make Basic authentication with Java
I tried to break a block with java (1)
I tried to implement TCP / IP + BIO with JAVA
[Java 11] I tried to execute Java without compiling with javac
I tried to implement Stalin sort with Java Collector
I tried to create a java8 development environment with Chocolatey
I tried to modernize a Java EE application with OpenShift.
[Java] I want to test standard input & standard output with JUnit
When I tried to scroll automatically with JScrollBar, the event handler was drawn only once.
When I tried to run Azure Kinect DK with Docker, it was blocked by EULA
I tried UDP communication with Java
I tried to translate the error message when executing Eclipse (Java)
What I was addicted to when implementing google authentication with rails
I tried to make an Android application with MVC now (Java)
I tried to summarize Java learning (1)
I tried to summarize Java 8 now
[Java] Java was said to be okay to concatenate strings with +, so I checked
I was addicted to a simple test of Jedis (Java-> Redis library)
Problems I was addicted to when building the digdag environment with docker
01. I tried to build an environment with SpringBoot + IntelliJ + MySQL (MyBatis) (Windows10)
I was addicted to unit testing with the buffer operator in RxJava
Java9 was included, so I tried jshell.
Java Artery-Easy to use unit test library
I want to write a unit test!
I tried using OpenCV with Java + Tomcat
I was addicted to the Spring-Batch test
I tried to implement ModanShogi with Kinx
[Java] I tried to connect using a connection pool with Servlet (tomcat) & MySQL & Java
When I tried to use a Wacom tablet with ubuntu 20.04, I didn't recognize it.
I want to test Action Cable with RSpec test
I tried to verify AdoptOpenJDK 11 (11.0.2) with Docker image
I tried to manage struts configuration with Coggle
I tried to manage login information with JMX
java I tried to break a simple block
I tried to implement deep learning in Java
I want to use java8 forEach with index
I was addicted to doing onActivityResult () with DialogFragment
I tried to output multiplication table in Java
What I did when I converted java to Kotlin
I tried to create Alexa skill in Java
I tried to create a shopping site administrator function / screen with Java and Spring
I tried to summarize the points to consider when acquiring location information with the iOS application ③
What I was addicted to when developing a Spring Boot application with VS Code
A memo that I was addicted to when making batch processing with Spring Boot
I tried to summarize the points to consider when acquiring location information with the iOS application ①
When I tried to support IPv6 easily with Docker-proxy, I couldn't do it before I knew it.
I tried to summarize the points to consider when acquiring location information with the iOS application ②
[Azure] I tried to create a Java application for free ~ Connect with FTP ~ [Beginner]
What I was addicted to when trying to properly openAPI/Swagger documentation with Rails + Grape + Grape Swagger
A story I was addicted to when getting a key that was automatically tried on MyBatis
Java: A story that made me feel uncomfortable when I was taught to compare strings with equals for no reason.
I tried what I wanted to try with Stream softly.
I tried to implement file upload with Spring MVC
I tried to read and output CSV with Outsystems
I tried to implement Firebase push notification in Java
How to unit test with JVM with source using RxAndroid
[Java] I tried to solve Paiza's B rank problem
I tried to operate SQS using AWS Java SDK
# 2 [Note] I tried to calculate multiplication tables in Java.