Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Effective .NET Memory Management

You're reading from   Effective .NET Memory Management Build memory-efficient cross-platform applications using .NET Core

Arrow left icon
Product type Paperback
Published in Jul 2024
Publisher Packt
ISBN-13 9781835461044
Length 270 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Trevoir Williams Trevoir Williams
Author Profile Icon Trevoir Williams
Trevoir Williams
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. Chapter 1: Memory Management Fundamentals 2. Chapter 2: Object Lifetimes and Garbage Collection FREE CHAPTER 3. Chapter 3: Memory Allocation and Data Structures 4. Chapter 4: Memory Leaks and Resource Management 5. Chapter 5: Advanced Memory Management Techniques 6. Chapter 6: Memory Profiling and Optimization 7. Chapter 7: Low-Level Programming 8. Chapter 8: Performance Considerations and Best Practices 9. Chapter 9: Final Thoughts
10. Index 11. Other Books You May Enjoy

Best practices for managing object lifetimes

Let’s look at some suggestions for writing more efficient and optimized code. One of the fundamental principles of writing code that efficiently uses your system resources is reducing object lifetimes. If we author code with this in mind, we can maximize resource utilization and guarantee smoother and more efficient applications.

We have just reviewed how the GC determines which objects should be cleaned from memory and which should stay for longer. We need to write our code to ensure that objects created for a purpose get marked for deletion once that purpose is fulfilled. As an object’s lifespan increases, its memory consumption grows over time. This increased consumption can give rise to issues such as memory leaks or unwarranted strain on the GC, leading to a decline in application performance. By proficiently handling object lifetimes and ensuring they persist only as long as essential, we can enhance memory efficiency...

You have been reading a chapter from
Effective .NET Memory Management
Published in: Jul 2024
Publisher: Packt
ISBN-13: 9781835461044
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at £16.99/month. Cancel anytime