
Effective .NET Memory Management
Description
Alles über E-Books | Antworten auf Fragen rund um E-Books, Kopierschutz und Dateiformate finden Sie in unserem Info- & Hilfebereich.
In today's software development landscape, efficient memory management is crucial for ensuring application performance and scalability. Effective .NET Memory Management addresses this need by explaining the intricacies of memory utilization within .NET Core apps, from fundamental concepts to advanced optimization techniques. Starting with an overview of memory management basics, you'll quickly go through .NET's garbage collection system. You'll grasp the mechanics of memory allocation and gain insights into the distinctions between stack and heap memory and the nuances of value types and reference types. Building on this foundation, this book will help you apply practical strategies to address real-world app demands, spanning profiling memory usage, spotting memory leaks, and diagnosing performance bottlenecks, through clear explanations and hands-on examples. This book goes beyond theory, detailing actionable techniques to optimize data structures, minimize memory fragmentation, and streamline memory access in scenarios involving multithreading and asynchronous programming for creating responsive and resource-efficient apps that can scale without sacrificing performance. By the end of this book, you'll have gained the knowledge to write clean, efficient code that maximizes memory usage and boosts app performance.
All prices
More details
Other editions
Additional editions

Content
- Cover
- Title Page
- Copyright and Credits
- Dedications
- Contributors
- Table of Contents
- Preface
- Chapter 1: Memory Management Fundamentals
- Overview of memory management
- Levels of memory management
- Fundamentals of memory management and allocation
- Units of memory storage
- The fundamentals of how memory works
- Automatic memory allocation in .NET
- The role of the garbage collector
- Garbage collection in .NET
- Impact of memory management on performance
- Impacts of poor memory management
- Key considerations
- Summary
- Chapter 2: Object Lifetimes and Garbage Collection
- Technical requirements
- Object allocation and deallocation
- Objects and how they are created
- Stack and heap allocation
- Generations and the garbage collection process
- Garbage collection in the LOH
- Best practices for managing object lifetimes
- Using local variables
- Using statements
- Use optimized data types and data structures
- Use weak reference types for short-lived data
- Use object pooling
- Summary
- Chapter 3: Memory Allocation and Data Structures
- Technical requirements
- Memory allocation mechanisms
- Allocation mechanisms in C/C++
- Allocation mechanisms in Java
- .NET allocation performance
- Choosing the best data structures
- Big O notation
- Replacing classes with structs wherever possible
- Using optimized collection types
- Pre-sizing data structures
- Accessing contiguous memory
- Handling large objects and arrays
- Using smaller objects
- Optimizing string usage
- Summary
- Chapter 4: Memory Leaks and Resource Management
- Technical requirements
- Identifying memory leaks
- Common causes of memory leaks
- Code review
- Stress testing
- Memory analysis in .NET
- Visual Studio diagnostic tools
- Analysis with the .NET CLI
- Best practices for avoiding memory leaks
- Using the using keyword with IDisposable objects
- Implementing IDisposable and Finalizer patterns
- Using Dependency Injection
- Summary
- Chapter 5: Advanced Memory Management Techniques
- Technical requirements
- Concurrent memory management
- Threads and thread pooling
- Lock mechanisms
- Task Parallel Library
- SemaphoreSlim for task-based synchronization
- PLINQ
- Concurrent collections
- Memory usage in multi-threaded applications
- Single-threaded versus multi-threaded approaches
- Parallel loops
- Exception handling in multi-threaded applications
- Memory management in asynchronous code
- Creating and using asynchronous methods
- Preventing memory leaks and best practices
- Summary
- Chapter 6: Memory Profiling and Optimization
- Technical requirements
- Memory profiling concepts
- Understanding and using profiling and tools
- Profiling memory usage and allocation
- Identifying allocation patterns with custom code
- Make Object ID to find memory leaks
- Event Tracing for Windows
- Downsides of profiling
- Writing unit tests for memory leaks
- What is unit testing?
- Testing for a memory leak
- Production and deployment considerations
- Using CI/CD pipelines
- Monitoring cloud environments
- Summary
- Chapter 7: Low-Level Programming
- Technical requirements
- Working with unsafe code
- Pointers and pointer operations
- Using the fixed statement
- Allocating and deallocating unmanaged memory
- Using the stackalloc keyword for stack allocation
- Using the Marshal class for memory management
- Interoperability with unmanaged code
- P/Invoke
- Using COM interop
- Interop marshaling
- Handling unmanaged resources with the SafeHandle class
- Summary
- Chapter 8: Performance Considerations and Best Practices
- Technical requirements
- Memory management in desktop environments
- Using Windows Forms
- Using Windows Presentation Foundation
- Memory management in web environments
- Using ADO.NET
- Using Entity Framework Core
- Caching patterns in ASP.NET Core
- Memory management in cloud environments
- Multi-tenancy and memory management
- Caching for memory management in cloud solutions
- Summary
- Chapter 9: Final Thoughts
- Index
- Other Books You May Enjoy
System requirements
File format: ePUB
Copy protection: Adobe-DRM (Digital Rights Management)
System requirements:
- Computer (Windows; MacOS X; Linux): Install the free reader Adobe Digital Editions prior to download (see eBook Help).
- Tablet/smartphone (Android; iOS): Install the free app Adobe Digital Editions or the app PocketBook before downloading (see eBook Help).
- E-reader: Bookeen, Kobo, Pocketbook, Sony, Tolino and many more (not Kindle).
The file format ePub works well for novels and non-fiction books – i.e., „flowing” text without complex layout. On an e-reader or smartphone, line and page breaks automatically adjust to fit the small displays.
This eBook uses Adobe-DRM, a „hard” copy protection. If the necessary requirements are not met, unfortunately you will not be able to open the eBook. You will therefore need to prepare your reading hardware before downloading.
Please note: We strongly recommend that you authorise using your personal Adobe ID after installation of any reading software.
For more information, see our ebook Help page.
File format: ePUB
Copy protection: without DRM (Digital Rights Management)
System requirements:
- Computer (Windows; MacOS X; Linux): Use a reader that can handle the file format ePUB, such as Adobe Digital Editions or FBReader – both free (see eBook Help).
- Tablet/Smartphone (Android; iOS): Install the free app Adobe Digital Editions or the app PocketBook (see eBook Help).
- E-reader: Bookeen, Kobo, Pocketbook, Sony, Tolino and many more (not Kindle).
The file format ePUB works well for novels and non-fiction books – i.e., 'flowing' text without complex layout. On an e-reader or smartphone, line and page breaks automatically adjust to fit the small displays.
This eBook does not use copy protection or Digital Rights Management
For more information, see our eBook Help page.