C# Memory Tricks: Learn How To Master The Garbage Collector (Udemy.com)

This course teaches you advanced C# memory management tricks that every professional .NET developer must know.

Created by: Mark Farragher

Produced in 2022

What you will learn

  • Learn how the Garbage Collector works
  • Master .NET memory optimization
  • Discover the truth about finalizers
  • Learn how to measure the memory footprint of your code
  • The unexpected memory footprint of List resizing
  • Structs versus classes - which one is better?
  • What assumptions does the GC make about object size and lifetime?
  • Manual deallocation with the Dispose pattern
  • ... and much more!

Quality Score

Content Quality
Video Quality
Qualified Instructor
Course Pace
Course Depth & Coverage

Overall Score : 94 / 100

Live Chat with CourseDuck's Co-Founder for Help

Need help deciding on a c# course? Or looking for more detail on Mark Farragher's C# Memory Tricks: Learn How To Master The Garbage Collector? Feel free to chat below.
Join CourseDuck's Online Learning Discord Community

Course Description

Last updated: November 17th, 2017 - Added new promo video
Modern computers have loads of memory. But it's very easy to burn through it all in seconds if your code is not efficient about allocating and using memory.
Did you know that one simple mistake can make your code allocate 1600 times more memory than absolutely necessary?

Don't be 'that developer' who keeps crashing the development server with an OutOfMemory exception!
And you certainly don't want to be responsible for inflating the hardware budget. Can you imagine having to explain to your team that 512 GB of memory is not enough to run your code on the production server?

Let me help you.
It doesn't have to be like this. If you have a good understanding of the garbage collection process and follow a few simple best practices, you can dramatically reduce the memory footprint of your code.

Sound good?
In the last 10 years I have learned the secrets of garbage collection in .NET, and in this course I am going to share them all with you.
In a series of short lectures I will take a detailed look at the garbage collection process. I will show you all of the memory allocation problems you can expect when writing C# code, like unexpected boxing, string duplication, collection resizing, and more. I'll teach you quick and easy strategies to resolve these problems.
By the end of this course you will be able to master the garbage collector.
Why should you take this course?

You should take this course if you are a beginner or intermediate C# developer and want to take your skills to the next level. Garbage collection and memory management might sound complicated, but all of my lectures are very easy to follow and I explain all topics with clear code and many instructive diagrams. You'll have no trouble following along.
Or maybe you're working on a critical section of code in a C# project, and need to make sure your memory usage is as efficient as possible? The tips and tricks in this course will help you immensely.
Or maybe you're preparing for a C# related job interview? This course will give you an excellent foundation to answer any questions they might throw at you.
30 day money-back guarantee
This course comes with an unconditional, Udemy backed, 30-day money-back guarantee. If you are dissatisfied with the course for any reason, simply request a refund and get your full purchase amount back, no questions asked.Who this course is for:
  • Beginner, intermediate, and advanced C# programmers who want to learn how to master the garbage collector.
  • Developers who are about to take a job interview and need to prepare for questions about memory allocation in .NET
  • Professionals who are writing a section of mission-critical code in a large C# project

*Some courses are excluded from this sale. Coupon not working? If the link above doesn't drop prices, clear the cookies in your browser and then click this link here.
Also, you may need to apply the coupon code directly on the cart page to get the discount.

Coupon Code

Instructor Details

Mark Farragher

Mark Farragher is a blogger, investor, serial entrepreneur, and the author of 11 successful IT courses on Udemy and other marketplaces. His career spans over two decades during which Mark has been a Founder twice and CTO three times, and has launched two lean startups in The Netherlands.
Mark became a Microsoft Certified Trainer in 2005 and started training classes in .NET development, web design, and Microsoft back-office servers. Today he uses his extensive knowledge of IT to help CTO's, architects, and other tech professionals with their leadership, communication, and technical skills.
Mark has MCSA and MCSD certifications from Microsoft and is a certified Microsoft Trainer and Scrum master. He speaks fluent English, Dutch, and German.



100 total reviews

5 star 4 star 3 star 2 star 1 star
% Complete
% Complete
% Complete
% Complete
% Complete

I learned a lot. I had no idea when I was using string concatenation stead of StringBuilder append.

By Thomas Govier on a month ago

Simple, great explanations, loved the chalk board idea, very useful and easy to absorb

By Piotr Plinkiewicz on 3 months ago

Great, in-depth and well explained how it all works in the background. Comprehensive knowledge about Garbage Collector and memory management. Highly recomended course of type "must have".

By Sathish kumar on 4 months ago

Outstanding course content and content delivery was good with complete picture. I recommend each and every C# developer should go through this course to stand out from the crowd.

By Lee Anderson on 6 months ago

I thought the course was good.Usage of mono wasn't great, there is no windows version available (have fun building from source) so I had to do the hard yards with VS and dotMemory to verify the lecture results.Verifying the results/actual memory allocation took a bit of work as the lectures demonstrated the overall concept but not a 1:1 reconciliation of the memory usage for the topic being discussed. Personally I like to 'do' and part of that is getting the numbers to line up.

By Terry Rice on 3 months ago

I really enjoyed this course and learned many interesting things about how to make my C# code more efficient with memory and to work friendlier with the Garbage Collector. I will use these tips to make my code more efficient instead of just coding like every other developer out there.

By Andrew Jakobs on 5 months ago

It's a great course on optimisations in regard to memory (and in result also speed). But having done the course 'C# performance tricks: How to radically optimize your code' before this course, I think it's a bit of a rip-off (don't know which course came first), because I think about 85% of this course is also used in the performance course.. I would suggest to combine both courses into one and drop the two separate courses..

By Vilas Talwekar on a month ago

Memory concepts are much clear now. Thank You!

By Emily Senft on 3 months ago

Clearly knows his stuff and gets it across well. Clear and concise!

By Alberto Gonzlez Balderas on 6 months ago

This course is great! The way of explain is clear and the tips are very useful.

By Subbulakshmi on 7 months ago

It gave a lot of insight on how the .net framework manages the memory. The course was easy to follow with simple examples

By Ali Aligiller on 2 months ago

It is very efficent course. It is worth.