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.

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?

EasyTechnical
77 practiced

You are asked to investigate memory use and GC behaviour in a production service. Which tools and techniques would you reach for across the runtimes you know, and what level of detail does each give you?

HardTechnical
70 practiced

Throughput in your service drops and profiling hints at a long tail of small allocations. How would you quantify how much of the cost is allocation and GC, estimate the payoff of the fixes you would consider, and make the case for the work to a product manager?

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.

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.

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.