Skip to content
Sharp

Memory Management interview questions

Metaspace, OutOfMemoryErrors, Stack vs Heap

27 questions with answers and explanations · 27 flashcards

Questions

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