Memory Management interview questions
Metaspace, OutOfMemoryErrors, Stack vs Heap
27 questions with answers and explanations · 27 flashcards
Questions
- What role does Metaspace play in Java's memory management?Multiple choiceMedium
- Which JVM flag would you use to analyze memory allocation and garbage collection behavior?Multiple choiceHard
- Why does a reference variable in Java memory management matter in this design?Multiple choiceMedium
- A service that creates many runtime proxies crashes with OutOfMemoryError: Metaspace. What is the most likely problem?Multiple choiceMedium
- Why do teams use the 'jstack' tool in Java in production code?Multiple choiceMedium
- In a multi-threaded Java application, where do the different threads store their method call frames?Multiple choiceMedium
- Why does the Z Garbage Collector (ZGC) over traditional collectors help in practice?Multiple choiceMedium
- How does the G1 Garbage Collector differ from traditional collectors in Java?Multiple choiceMedium
- In Java's generational garbage collection, what is the primary benefit of separating young and old generations?Multiple choiceMedium
- How does Generational Garbage Collection optimize memory management in Java?Multiple choiceHard
- How does Java handle memory for objects that are no longer reachable from any references?Multiple choiceHard
- Why is simply increasing -Xmx a weak first response to an allocation-churn problem?Multiple choiceMedium
- What happens when a Java application encounters a 'Stop-The-World' pause?Multiple choiceEasy
- How does the Garbage-First Garbage Collector (G1GC) optimize garbage collection in large applications?Multiple choiceHard
- When a method in Java completes, what happens to its stack frame?Multiple choiceMedium
- Which section of memory is used to store static variables and loaded classes in the JVM?Multiple choiceMedium
- Why does the heap in Java's memory management matter in practice?Multiple choiceEasy
- What does the 'jmap' tool in the context of Java memory management mainly do?Multiple choiceMedium
- Which JVM tool can be used to capture a snapshot of the heap for analysis?Multiple choiceMedium
- What happens to the memory allocated for objects on the Heap when they are no longer referenced?Multiple choiceEasy
- What happens during a 'Stop-The-World' pause in Java garbage collection?Multiple choiceEasy
- What will happen to the local variables stored on the stack when a method execution is completed in Java?Multiple choiceEasy
- Which runtime artifact best answers the question, "What objects are still retained and who is holding references to them?"?Multiple choiceMedium
- In Java, where are local variables and method call frames stored?Multiple choiceMedium
- Which of the following correctly describes how references are handled in Java memory management?Multiple choiceHard
- During a heavy load on an e-commerce site, how can thread dumps assist in diagnosing JVM issues?Multiple choiceHard
- Which section of memory in the JVM is primarily used to store and manage objects?Multiple choiceEasy