How C# garbage collection works | tutorial


This C# Express tutorial explores how garbage collection works to clear up memory space. Watch more at

This specific tutorial is just a single movie from the chapter eleven of the C# Essential Training course presented by author Joe Marini. The complete C# Essential Training course has a total duration of 6 hours and 44 minutes, and demonstrates how to use C# language features, compile and run code, handle exceptions, read and write files, and address common compilation issues through debugging

C# Essential Training table of contents:

1. Getting Started with C#
2. C# Language Fundamentals
3. Program Flow
4. Variables
5. Custom Classes and Objects
6. Collections
7. More Complex Classes
8. Exceptions
9. File Management
10. Some Advanced C#
11. Garbage Collection
12. Debugging



  1. The video should be titled "What does the garbage collector do in C#" instead of how it works. Because you keep saying it's invisible to the developer and they don't have to worry about its implementation or how it works.

  2. Anything similar for Cities Skylines? Awful memory management there
    I managed to run the game in a fan-less laptop with minimum specs for the game, keeping temperatures low with the help of the parameter "-limitfps 10" and keeping CPU fixed at the lowest frequency. But now I stumbled across this "out of memory" problem, and I wanna figure out if I can downgrade the assets used by the game, because according to the developers a single road vehicle can have a few hundred polygons. For a game of such big scope as a city builder, I find this beyond reckless and unnaceptable. People with 32 GB of memory are having problems with this game, this is insane! I'm glad I didn't spend a buck upgrading hardware to play a game that crashes no matter what.

  3. how about this

    void myMethod{
    } //<– myObject freed by this line right

    base on your explanation, while otherThread is running, the myObject already freed by end scope of myMethod. is'n it?


Please enter your comment!
Please enter your name here