Memory Management & Garbage Collection Questions

Memory as a performance resource in garbage-collected and managed runtimes (JVM, .NET, Go, V8, CPython). Covers allocation patterns and allocation pressure (boxing, value versus reference types, stack versus heap), GC algorithms and behaviour (generational, mark-and-sweep, reference counting, concurrent and compacting collectors, GC roots), pauses and tuning, heap sizing, fragmentation, object pooling and buffer reuse, data-oriented layouts and per-object overhead, on-heap versus off-heap trade-offs, and detecting and fixing memory leaks with heap dumps and profilers, including leaks from caches, closures, goroutines, asyncio tasks and native extensions. Emphasizes how memory pressure affects throughput, latency and stability, including low-latency and frame-rate-bound applications. Pointer, ownership and manual-allocation semantics, embedded memory budgets, virtual memory and paging, generic data-processing memory tricks, and GPU framework memory are covered elsewhere.

MediumBehavioral
90 practiced

Describe a time you had to diagnose a memory leak in production. Explain your diagnostic steps (heap dumps, profilers, flame graphs), the root cause you found, the fix you deployed, and how you monitored to ensure the leak did not recur.

HardTechnical
86 practiced

Your JVM services have rare but severe 99.99th percentile latencies caused by long GC pauses. How would you attack it at the runtime, application and container levels, and how would you measure the improvement and roll out safely?

HardTechnical
82 practiced

How do large pages and NUMA affect GC and memory performance for a JVM process? When would enabling huge pages help the collector, and when could it hurt?

HardTechnical
72 practiced

A long-running Java service shows heap utilisation creeping up over weeks. Walk me through finding out whether it is a true leak or just retained cache, what you would capture in production, and how you would fix and verify it.

HardTechnical
93 practiced

A JVM service uses large direct ByteBuffers. Its heap looks healthy, but the container is OOM-killed. How do you find where the memory went, and what would you change about how the buffers are allocated and released?

Unlock Full Question Bank

Get access to all 8 Memory Management & Garbage Collection interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.