I trying to diagnose a memory leak while running my integration tests in my Spring Boot App.
When I am running :
./gradlew test -i --XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/Users/ng.newbie/Desktop/heapdump.bin
I keep getting OOM errors:
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "pem.item.service.exchange.allocation-97" Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "pem.item.service.exchange.itemAssortment-97" Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "pem.item.service.exchange.order-97" Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "pem.item.service.exchange.planning-97" Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "HikariPool-37 housekeeper" Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "HikariPool-1 housekeeper"
But no heap dump in the specified directory.
I have also tried adding the following to my gradle.properties
:
org.gradle.jvmargs=-XX:MaxPermSize=512m -XX:PermSize=128m -Xmx1024m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/Users/ng.newbie/Desktop/crash.hprof
No change.
What am I doing wrong ?
How can I collect the heap dumps of the gradle test
?
Advertisement
Answer
Add the following in the build.gradle
file
test { jvmArgs '-XX:+HeapDumpOnOutOfMemoryError' }