1Z0-811 What is Java Practice Question
An application throws 'java.lang.OutOfMemoryError: Java heap space'. Which JVM option can help generate diagnostic information to identify the cause?
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
-XX:+HeapDumpOnOutOfMemoryError
XX:+HeapDumpOnOutOfMemoryError instructs the JVM to generate a heap dump file when an OutOfMemoryError occurs, which can be analyzed to identify memory leaks or other causes. Option A (-version) prints the Java version and does not help with diagnostics. Option B (-verbose:gc) prints garbage collection details but does not produce a heap dump at the time of failure. Option D (-Xmx) sets the maximum heap size, which may delay or prevent the error but does not provide diagnostic information about the cause.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
-version
Why it's wrong here
Prints Java version; irrelevant to troubleshooting OOM.
- ✗
-verbose:gc
Why it's wrong here
Verbose GC logs garbage collection events but does not generate a heap dump.
- ✓
-XX:+HeapDumpOnOutOfMemoryError
Why this is correct
This option produces a heap dump when OutOfMemoryError occurs, useful for analysis.
- ✗
-Xmx
Why it's wrong here
Sets maximum heap size; does not provide diagnostic information.
Go deeper
Related to this question
About these practice questions
One of 481 original 1Z0-811 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This 1Z0-811 practice question is part of Courseiva's free Oracle certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 1Z0-811 exam.