PrepPilotPractise free

.NET Runtime & Performance interview questions

CLR, GC, memory, threading, profiling

17 questions · GC · updated November 2026

Practise these as flashcards. One or two lines each; the ones you miss come back first.

Start free

Core questions

What is the difference between .NET and .NET Framework?

.NET is a cross-platform, open-source runtime supporting Windows, Linux, and macOS, while .NET Framework is Windows-only and considered legacy. .NET offers unified versioning and LTS releases, making it suitable for modern development.

What is the CLR in .NET?

The Common Language Runtime (CLR) is the execution engine for .NET applications. It manages memory, handles garbage collection, and provides services like security and exception handling.

What are the generations in .NET garbage collection?

There are three generations: Gen 0 for short-lived objects, Gen 1 for objects surviving one collection, and Gen 2 for long-lived objects. This generational model helps optimize memory reclamation.

What is the Large Object Heap (LOH)?

The LOH is a special heap for objects larger than 85KB. It is collected less frequently and can become fragmented, affecting memory usage.

Intermediate questions

How does tiered compilation improve .NET performance?

Tiered compilation allows the JIT to compile methods quickly for fast startup, then recompile hot methods with optimizations. This approach balances startup time and throughput, improving overall performance.

When would you use server GC versus workstation GC?

I use server GC for high-throughput, multi-core environments like web servers, as it performs parallel collections. Workstation GC is better for desktop apps where responsiveness is more important than throughput.

How can Span<T> help reduce allocations?

Span<T> allows slicing and processing arrays and buffers without allocating new memory on the heap. Since it's stack-only, it helps avoid unnecessary allocations and improves performance, especially in tight loops.

What is thread pool starvation and how do you diagnose it?

Thread pool starvation happens when all thread pool threads are busy, causing delays in task scheduling. I diagnose it by monitoring thread pool metrics and checking for blocking calls or excessive synchronous work.

How do you monitor .NET runtime performance in production?

I use dotnet-counters for live metrics like CPU, GC, and thread pool usage. For deeper analysis, I collect traces with dotnet-trace and capture dumps with dotnet-dump when needed.

What are the benefits of using Memory<T> over Span<T>?

Memory<T> can be used across async boundaries and supports heap allocation, making it suitable for scenarios where data needs to persist beyond the current stack frame. Span<T> is stack-only and can't be used in async methods.

How does .NET's generational GC improve performance?

By segregating objects by their lifespan, generational GC reduces the frequency and cost of collecting long-lived objects. Most collections happen in Gen 0, which is fast and minimizes application pauses.

What are the risks of LOH fragmentation and how do you mitigate them?

LOH fragmentation can waste memory and cause allocation failures. To mitigate, I minimize large allocations, reuse buffers, and monitor LOH usage with profiling tools. If fragmentation is severe, I consider redesigning data structures.

Senior questions

Describe how you would diagnose a memory leak in a .NET production app.

See the answer in the app, free

How would you optimize a .NET service suffering from slow startup times?

See the answer in the app, free

Explain the trade-offs between AOT and JIT compilation in .NET.

See the answer in the app, free

How would you handle thread pool starvation in a high-load .NET web app?

See the answer in the app, free

How do you use dotnet-trace and dotnet-dump together to debug a production issue?

See the answer in the app, free

More .NET topics