When -XX:+HeapDumpOnOutOfMemoryError is specified, by default the heap dump file is written to current working directory.
The default heap dump directory should be the default temp directory. Frequently the current working directory is read-only or doesn't have a lot of free space, so the temp directory is a better default.
The default heap dump directory should be the default temp directory. Frequently the current working directory is read-only or doesn't have a lot of free space, so the temp directory is a better default.