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
73 practiced

In a managed runtime, how do stack and heap allocation differ, and how are value types and reference types stored? Using Java, C# or Go as an example, explain when the runtime can avoid a heap allocation and what that does to GC load.

EasyTechnical
86 practiced

What are boxing and unboxing, and why can boxing create allocation pressure in a managed runtime? Give an example in C# or Java, and say how you would spot it in a hot path.

HardTechnical
84 practiced

You inherit a C# analytics client inside a Unity game that causes intermittent frame drops from GC spikes. Propose a plan to hold 60 FPS while still capturing analytics reliably.

MediumTechnical
77 practiced

In a Unity game running at 60 FPS, when does preferring a C# struct over a class reduce GC pressure, and when does it backfire? Cover copying versus boxing and where the data actually lives.

MediumTechnical
70 practiced

Compare an object-per-record design with a data-oriented layout for processing millions of small records in memory. How does each affect allocation rate, cache behaviour and GC cost?

That is every published Memory Management & Garbage Collection question for Game Developer so far. Browse the other topics in this category, or practice this one interactively.