Session
What Happens After Main? Inside the .NET JIT and Garbage Collector
What really happens after .NET reaches your code?
Getting a .NET application to its managed entry point is only the beginning. A method may be compiled more than once, and the native code first produced for it may not be the code that continues to run.
In this code and demo-heavy session, we’ll follow one C# method through its life inside the .NET runtime. We’ll see how its IL is transformed into native machine instructions and explore optimisations including inlining, devirtualisation and bounds-check elimination.
We’ll then investigate tiered compilation and dynamic profile-guided optimisation to discover how the runtime observes a running application and uses what it learns to produce better code.
Finally, we’ll follow the objects allocated by our method into the managed heap. We’ll examine why common allocations can be remarkably cheap, how the JIT tracks managed references, and how the garbage collector determines which objects remain reachable and which memory can be reclaimed.
Using JIT output, native assembly, runtime traces and heap inspection tools, we’ll reveal how the JIT and garbage collector cooperate beneath our C# code.
You’ll leave with a practical mental model of managed execution and a clearer understanding of the runtime behaviour exposed by profilers and diagnostic tools.
This is essentially a sequel to my talk "Unveiling .NET Secrets with the World's Smallest C# Program".
Steve Gordon
Engineer at Elastic, Microsoft MVP and Pluralsight author
Eastbourne, United Kingdom
Links
Please note that Sessionize is not responsible for the accuracy or validity of the data provided by speakers. If you suspect this profile to be fake or spam, please let us know.
Jump to top