我在 Spring Boot 應用程式中運行集成測驗時嘗試診斷記憶體泄漏。
當我跑步時:
./gradlew test -i --XX: HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/Users/ng.newbie/Desktop/heapdump.bin
我不斷收到 OOM 錯誤:
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"
但指定目錄中沒有堆轉儲。
我還嘗試將以下內容添加到我的gradle.properties:
org.gradle.jvmargs=-XX:MaxPermSize=512m -XX:PermSize=128m -Xmx1024m -XX: HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/Users/ng.newbie/Desktop/crash.hprof
不用找了。
我究竟做錯了什么 ?
如何收集 的堆轉儲gradle test?
uj5u.com熱心網友回復:
build.gradle在檔案中添加以下內容
test {
jvmArgs '-XX: HeapDumpOnOutOfMemoryError'
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/439924.html
