You are previewing Under the Hood of .NET Memory Management.
O'Reilly logo
Under the Hood of .NET Memory Management

Book Description

This book starts with an introduction to the core concepts of .NET memory management and garbage collection, and then quickly layers on additional details and intricacies. Once you're up to speed, you can dive into the guided troubleshooting tour, and tips for engineering your application to maximise performance. And to finish off, take a look at some more sophisticated considerations, and even a peek inside the Windows memory model.

Table of Contents

  1. Cover Page
  2. Title Page
  3. Copyright Page
  4. Table of Contents
  5. About the Authors
  6. Introduction
  7. Section 1: Introduction to .NET Memory Management
    1. Chapter 1: Prelude
      1. Overview
      2. Stack
      3. Heap
        1. More on value and reference types
        2. Passing parameters
        3. Boxing and unboxing
      4. More on the Heap
        1. Garbage collection
      5. Static Objects
        1. Static methods and fields
        2. Thread Statics
      6. Summary
    2. Chapter 2: The Simple Heap Model
      1. Managed Heaps
        1. How big is an object?
        2. Small Object Heap
        3. Optimizing garbage collection
        4. Generational garbage collection
        5. Finalization
        6. Large Object Heap
      2. Summary
    3. Chapter 3: A Little More Detail
      1. What I Didn't Tell You Earlier
        1. The card table
      2. A Bit About Segments
      3. Garbage Collection Performance
        1. Workstation GC mode
        2. Server GC mode
        3. Configuring the GC
      4. Runtime GC Latency Control
      5. GC Notifications
      6. Weak References
        1. Under the hood
      7. More on the LOH
      8. Object Pinning and GC Handles
        1. GC Handles
        2. Object pinning
        3. Problems with object pinning
      9. Summary
  8. Section 2: Troubleshooting
    1. What's Coming Next
      1. Language
      2. Best practices
      3. Symptom flowcharts
    2. Chapter 4: Common Memory Problems
      1. Types
        1. Value types
        2. Reference types
      2. Memory Leaks
        1. Disposing of unmanaged resources
      3. Simple Value Types
        1. Overflow checking
      4. Strings
        1. Intern pool
        2. Concatenation
      5. Structs
      6. Classes
      7. Size of an Object
      8. Delegates
        1. Closures
      9. Effects of Yield
      10. Arrays and Collections
      11. Excessive References
      12. Excessive Writes and Hitting the Write Barrier
      13. Fragmentation
      14. Long-Lived Objects
      15. Conclusion
    3. Chapter 5: Application-Specific Problems
      1. Introduction
      2. IIS and ASP.NET
        1. Caching
        2. Debug
        3. StringBuilder
      3. ADO.NET
        1. LINQ
      4. Windows Presentation Foundation (WPF)
        1. Event handlers
        2. Weak event pattern
        3. Command bindings
        4. Data binding
      5. Windows Communication Framework
        1. Benefits
        2. Drawbacks
        3. Disposable
        4. Configuration
      6. Conclusion
  9. Section 3: Deeper .NET
    1. Chapter 6: A Few More Advanced Topics
      1. Introduction
      2. 32-Bit vs. 64-Bit
      3. Survey of Garbage Collection Flavors
      4. Garbage Collection Notification
      5. Weak References
      6. Marshaling
      7. Conclusion
    2. Chapter 7: The Windows Memory Model
      1. .NET/OS Interaction
      2. Virtual and Physical Memory
        1. Pages
        2. The process address space
      3. Memory Manager
        1. Using the memory manager
        2. Keeping track
      4. Page Frame Database
      5. The Page Table
      6. Virtual Addresses and the Page Table
      7. Page Table Entry
      8. Page Faults
      9. Locking Memory
      10. Putting It All Together
      11. Memory Caching
      12. The Long and Winding Road
      13. Summary