InterviewStack.io LogoInterviewStack.io

Memory Management & Garbage Collection Questions

Managing memory as a performance resource, in both managed-runtime and manual-allocation contexts. Covers allocation patterns, garbage-collection behavior and tuning, pauses and fragmentation, and detecting and fixing memory and resource leaks. Emphasizes the effect of memory pressure on throughput, latency, and stability.

HardTechnical
86 practiced
Your JVM-based services are experiencing rare but severe tail latencies (99.99th percentile) due to long garbage collection pauses. As an SRE, propose mitigation strategies at the JVM configuration level (GC selection/tuning), application level (object allocation reduction), and system level (container limits, CPU pinning). Describe how you would measure improvements and safely roll out changes.
HardTechnical
82 practiced
A JVM-based production service shows steadily increasing heap usage under sustained load. You suspect a memory leak. Detail the investigation steps using GC logs, heap dumps, async-profiler or Java Flight Recorder, and Prometheus JVM metrics. Include commands to capture diagnostics, sampling strategy to limit production impact, and immediate mitigations while you investigate.
MediumTechnical
103 practiced
A deployment introduced a change that increases memory usage gradually, causing OOM crashes after several hours. Describe how you would instrument and detect memory leaks in production and outline a remediation path that minimizes customer impact (including immediate mitigations and long-term fixes).
HardTechnical
76 practiced
A third-party telemetry SDK used in your Python agent is suspected to leak memory. Outline a plan to instrument the agent, run deterministic experiments, isolate whether the leak originates in the SDK, and propose mitigations you could apply while working with the vendor.

Unlock Full Question Bank

Get access to hundreds of Memory Management & Garbage Collection interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.