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.

EasyTechnical
70 practiced

Can a memory leak happen in a garbage-collected language? Explain how, and how you would tell a real leak from normal heap growth.

MediumTechnical
87 practiced

A Go service starts many goroutines and channels and its memory keeps climbing. How would you profile it to separate goroutine leaks from slice retention and plain allocation churn, and what would you change?

HardSystem Design
75 practiced

Design a low-latency request service with a 10 ms p99.9 target and an 8 GB memory limit per instance, written in Java, Go or another managed runtime. How do you keep GC pauses and allocation overhead in check, and how do you size the heap against the container limit?

MediumTechnical
131 practiced

A Python service's memory use grew after a release. How would you use tracemalloc to find which code paths allocate the most, and how would you read the difference between two snapshots?

EasyTechnical
125 practiced

What is garbage collection and why do managed runtimes need it? Walk me through how a collector decides what to free, and what an application developer notices in production when it is working against them.

Unlock Full Question Bank

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

Sign in to Continue

Join thousands of developers preparing for their dream job.