.NET Memory – Performance & Troubleshooting

After this workshop, you will get a full understanding of the automatic memory management in a managed environment of the .NET runtime (both Framework and Core). It will allow you to write more memory-aware code, as well as to diagnose any common problems you may ever encounter due to this aspect. Moreover, this workshops try to explain not only how things may be used, but also how and why they were implemented so, and not otherwise. With such broader and deeper understanding you should easily solve and understand any other, upcoming problems and topics that are not directly covered in this workshop.

This workshop is split into 50/50 between theory and practice. Every mentioned aspect is exercised practically - in the context of seeing things "live" and/or diagnosing possible problems related to them. There are also coding parts where attendees try to apply knowledge about gained APIs, solving diagnosed problems or trying to optimize benchmarked code. 

What you will learn

  • Become a better .NET programmer, gain knowledge about memory management 
  • Understand how and why memory is managed by .NET runtime  
  • Learn how to write memory-aware code 
  • Explore various aspects of advanced memory management 
  • Learn how to monitor and diagnose various memory related problems 
  • Learn the details of the .NET GC implementation

    Target audience

    Every .NET developers will benefit from this workshop! Starting from the basics how I do .NET runtime works, so the workshop will go through all aspects of memory management that are relevant to today's .NET developers.


    The course assumes that as a participant you are comfortable reading and writing programs that use modern C # constructions, such as async / await, Linq and lambda expressions.

    Day 1

    Basic concepts

    • manual vs automatic memory management
    • operating system, virtual memory and .NET process

    Memory partitioning

    • generations - what's "healthy state"?
    • Small and Large Object Heap - are there any caveats?
    • segments - should I care?


    • how allocation work in SOH and LOH - is it "cheap"?
    • common sources of allocations and avoiding them
    • stackalloc - our super-fast allocator

    Garbage collector

    • how it works - Mark, Plan, Sweep and Compact
    • OutOfMemoryException - why, how, when?
    • Memory Leak!
    • Server vs Workstation - which to choose?
    • Background vs Non-concurrent - which to choose?
    • programmatically control

    Day 2

    Lifetime management

    • explicit cleanup - IDisposable interface
    • implicit cleanup - finalization
    • weak references

    Advanced topics

    • structures all the way - ref structs
    • Span and Memory
    • Unsafe class and code
    • Pipelines

    Data-oriented design

    • tactical data-oriented design
    • strategic data-oriented design


    • ClrMD library
    • TraceEvent library

    Related articles

    • New courses this spring

      Now we are launching 5 new courses! Machine learning, React, Docker, Scrum or .NET no matter what you want to broaden yourself in, we have it.

      Read more

    Course info

    Course code: T333
    Duration: 2 days
    Price: 21 500 SEK
    Language: English

    Course schedule

    There are no set dates for this course at the moment, but contact us and we'll make arrangements!


    Konrad KokosaKonrad Kokosa


    Contact us for details

    +46 40 61 70 720

    All prices excluding VAT