gradleでtest時にheapdump
testタスク実行時のjvmArgsを設定しとけば良いっぽい
apply plugin: "java"
repositories {
jcenter()
}
dependencies {
testCompile "junit:junit:4.12"
}
test {
jvmArgs "-agentlib:hprof=format=b,file=heapdump.out"
}
参考: http://docs.oracle.com/javase/jp/7/technotes/samples/hprof.html