Workshop: Exploring memory in .NET applications

.NET provides a safe type system which saves us from most memory problems we had in native applications. However, it still exposes API to manipulate the memory directly which we can use to increase performance in some scenarios where speed is critical. In this workshop we will understand memory structure and what can be done beyond reference and value types. We will see how to allocate reference type on the stack, how to implement list faster than the provided List of T, how to serialize objects by reading their bytes directly, or how to hide them from GC.

Objectives:
  • Understanding of Windows and x86 CPU architecture, how they work together and how they are used by .NET platform.
  • Understanding .NET memory structures
  • Manual memory management
  • Hiding objects from GC

Requirements:
  • Windows 10 running on x86 architecture
  • Visual Studio 2019
  • WinDBG