Performance Tuning · interview question
How can static references cause memory leaks in Java?
Multiple choiceHardchapter-14-curatedpremiumperformance-tuningoutofmemoryerrors
Answer and explanation
Correct answer
C. Static references persist for the lifetime of the application, preventing GC of objects.
Why
Static references in Java remain in memory for the duration of the application's lifetime. If they reference objects that are no longer needed, those objects cannot be garbage collected, leading to memory leaks.
Test yourself on Performance Tuning
A free test with instant, explained results. No account needed.
More Performance Tuning questions
- In a system using the Z Garbage Collector (ZGC), what is a notable advantage compared to traditional Stop-The-World…
- How would you explain a common cause of a 'java.lang.OutOfMemoryError: Metaspace' error in a JVM application in an…
- How would you explain a key advantage of the Z Garbage Collector (ZGC) over traditional garbage collectors in an…
- CPU is pinned and requests are hanging. Which artifact tells you what threads are doing right now?
- What does the Z Garbage Collector (ZGC) mainly aim to achieve?
- In the context of JVM garbage collection, what is the main benefit of using the G1 Garbage Collector over traditional…