How To Optimize Memory Use In C# | Mark Farragher | Skillshare

How To Optimize Memory Use In C#

Mark Farragher, Microsoft Certified Trainer

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
17 Videos (2h 59m)
    • Optimize memory use in C#

      2:37
    • Introduction to .NET memory management

      3:44
    • What is stack memory?

      5:23
    • What is heap memory?

      4:59
    • How are value types stored in memory?

      5:42
    • How are reference types stored in memory?

      5:29
    • What is boxing and unboxing?

      6:03
    • How does garbage collection work in .NET? in

      16:46
    • Tip #1: optimise your code for garbage collection

      18:20
    • Tip #2: avoid class finalizers

      17:11
    • Tip #3: use the dispose pattern

      16:34
    • Tip #4: avoid boxing and unboxing

      9:51
    • Tip #5: do not add many strings together

      16:08
    • Tip #6: use structs instead of classes

      17:55
    • Tip #7: always pre-allocate collections

      12:30
    • Tip #8: do not materialize LINQ expressions early

      18:04
    • Course recap

      1:44

About This Class

3bb6dc07

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 256 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.

2

Students

--

Projects

  • --
  • Beginner
  • Intermediate
  • Advanced
  • All Levels
  • Beg/Int
  • Int/Adv

Level

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.

Mark Farragher

Microsoft Certified Trainer

Mark Farragher is a blogger, investor, serial entrepreneur, and the author of 11 successful Udemy courses. He has been a Founder and CTO, and has launched two startups in the Netherlands. Mark became a Microsoft Certified Trainer in 2005. Today he uses his extensive knowledge to help tech professionals with their leadership, communication, and technical skills.

See full profile

Technology Mobile Development Csharp
Report class