Span<T>, Memory<T> and Ref Structs in .NET Explained
Learn Span, ReadOnlySpan, Memory and ref structs in .NET: zero-copy slicing, stackalloc, ArrayPool, SearchValues, async buffers and C# 14 span conversions.
15 articles about Memory Management: in-depth .NET and AI guides, senior interview questions and AI news on DotNet AI Hub.
Learn Span, ReadOnlySpan, Memory and ref structs in .NET: zero-copy slicing, stackalloc, ArrayPool, SearchValues, async buffers and C# 14 span conversions.
A deep dive into CLR internals: IL and metadata, the type loader, MethodTables, precode and JIT, interface dispatch, object layout, AssemblyLoadContext and SOS.
How the .NET garbage collector works: generations, LOH and POH, regions, workstation vs server GC, DATAS, container limits, finalization and tuning.
How memory leaks happen in a garbage-collected runtime, the most common causes, and a step-by-step workflow to find and fix them with gcdump and SOS.
Practical high-performance .NET techniques: measure first, cut allocations, pick fast collections, vectorize hot loops and tune the GC in .NET 8 to 11.
Senior-level thread synchronization interview questions covering lock, Monitor, the .NET 9 Lock type, SemaphoreSlim, ReaderWriterLockSlim and the memory model.
Senior .NET interview questions on GC internals: generations, card tables, LOH/POH and regions, server vs workstation GC, DATAS, latency modes and containers.
Senior .NET interview questions on the object header, boxing costs, struct design, StructLayout, readonly structs, ref returns, in parameters and equality.
Senior C# interview questions on multicast delegates, event memory leaks, weak event patterns, closure capture, static lambdas and events versus channels.
Senior C# interview questions on the dispose pattern, finalizers, SafeHandle, IAsyncDisposable, DI disposal rules and HttpClient socket exhaustion.
Senior C# interview questions on record equality, with-expressions, record struct vs readonly struct, frozen vs immutable collections and value objects.
Senior .NET interview questions on cutting allocations: ArrayPool, ObjectPool, RecyclableMemoryStream, string.Create, hidden boxing, closures and LINQ costs.
Senior-level interview questions on Dictionary and HashSet internals, List growth, ConcurrentDictionary, frozen and immutable collections and presizing.
Lead-level .NET interview questions on diagnosing memory leaks: counters, gcdump, SOS dumpheap and gcroot, unmanaged leaks, fixes and regression monitoring.
Senior .NET interview questions on Span<T> and Memory<T>: ref struct rules, stackalloc safety, ArrayPool pooling, allocation-free parsing and review pitfalls.