
عنوان:
C++ Memory Management
نویسنده:
Patrice Roy
انتشارات:
Packt Publishing
تاریخ انتشار:
2025
حجم:
4.9MB
معرفی کتاب:" مدیریت حافظه در ++C: نوشتن کدهای کمحجمتر و ایمنتر در ++C با استفاده از تکنیکهای اثباتشدهی مدیریت حافظه ویرایش: اول"
این کتاب با تکیه بر امکانات مدرن زبان ++C، رویکردی نوآورانه برای مدیریت حافظه ارائه میدهد و به شما کمک میکند برنامههایی سریعتر، کوچکتر، ایمنتر و قابلپیشبینیتر بنویسید.
ویژگیهای کلیدی
- استفاده از مفاهیم مدرن زبان ++C برای ارتقاء ایمنی و قابلیت اطمینان
- درک عمیقتر از مدل حافظه و عمر شیء
- سازگاری کامل با نیازهای خاص معماریهای محدود (سیستمهای تعبیهشده، بلادرنگ و بازی)
درباره کتاب
نوشتهی پاتریس روآ، عضو کمیته استاندارد ISO برای زبان ++C، این کتاب راهنمایی ساختیافته برای مهارتیافتن در زمینه مدیریت حافظه در ++C است. با بررسی تکنیکهای تخصیص حافظه، ساخت کانتینرهای سفارشی، و استفاده هوشمندانه از Smart Pointers، یاد میگیرید چگونه کنترل کامل روی منابع برنامه داشته باشید.
آنچه خواهید آموخت
- تسلط بر مدل شیء در ++C برای کدی خواناتر و پایدارتر
- خودکارسازی مدیریت منابع برای کاهش باگهای حافظه
- ایجاد تخصیصدهندههای سفارشی و کانتینرهای بهینه
- استفاده از ابزارهای سطح پایین بدون قربانیکردن ایمنی
- ساخت کدهای سازگار با منابع محدود برای محیطهایی مانند بازیها و سیستمهای نهفته
مخاطبان این کتاب
اگر برنامهنویس با تجربهی ++C هستید یا در حال مهاجرت از زبانهایی مانند C یا Rust میباشید و به دنبال کنترل بهتر روی حافظه هستید، این کتاب برای شماست. بهویژه اگر در حوزههایی چون توسعه بازی، برنامهنویسی بلادرنگ یا سیستمهای توکار فعالیت دارید، مطالب این کتاب به شما دیدگاهی عملی و عمیق میدهد.
پیشنیازها
دانش پایهای از برنامهنویسی ++C و مفاهیم همروندی به شما کمک خواهد کرد بیشترین بهره را از مطالب پیشرفته این کتاب ببرید.
فهرست مطالب
- Foreword
- Contributors
- About the author
- About the reviewers
- Preface
- Part 1: Memory in C++
- Chapter 1: Objects, Pointers, and References
- Technical requirements
- Representation of memory in C++
- Understanding the fundamental properties of objects
- Arrays
- Summary
- Chapter 2: Things to Be Careful With
- Different kinds of evil
- Pointers
- Type punning
- Summary
- Chapter 3: Casts and cv-qualifications
- Technical requirements
- What is a cast?
- Safety in the type system – cv-qualifications
- The C++ casts
- Summary
- Part 2: Implicit Memory Management Techniques
- Chapter 4: Using Destructors
- Technical requirements
- On destructors: a short recap
- Managing resources
- The RAII idiom
- Some pitfalls
- Standard resource management automation tools
- Summary
- Chapter 5: Using Standard Smart Pointers
- Technical requirements
- The standard smart pointers
- Type unique_ptr
- Types shared_ptr and weak_ptr
- When to use raw pointers
- Summary
- Chapter 6: Writing Smart Pointers
- Technical requirements
- Ownership semantics
- Writing your own (naïve) unique_ptr
- Writing your own (naïve) shared_ptr
- Writing a policy-based duplicating pointer
- Some not-so-smart yet useful smart pointers
- Summary
- Part 3: Taking Control (of Memory Management Mechanisms)
- Chapter 7: Overloading Memory Allocation Operators
- Why would one overload allocation functions?
- Brief overview of the C language allocation functions
- Overview of the C++ allocation operators
- Summary
- Chapter 8: Writing a Naïve Leak Detector
- Technical requirements
- The plan
- A first implementation (that almost works)
- Identifying (and fixing) the problems
- Revisiting our implementation (and lessons learned)
- Summary
- Chapter 9: Atypical Allocation Mechanisms
- Technical requirements
- Placement new and memory-mapped hardware
- Simplifying nothrow new usage
- Out-of-memory situations and new_handler
- Standard C++ and exotic memory
- Summary
- Chapter 10: Arena-Based Memory Management and Other Optimizations
- Technical requirements
- Arena-based memory management
- When parameters change
- Chunked pools
- Summary
- Chapter 11: Deferred Reclamation
- Technical requirements
- What do we mean by deferred reclamation?
- Reclamation (without finalization) at the end of the program
- Reclamation and finalization at the end of the program
- Reclamation and finalization at the end of the scope
- Summary
- Part 4: Writing Generic Containers (and a Bit More)
- Chapter 12: Writing Generic Containers with Explicit Memory Management
- Technical requirements
- Writing your own vector<T> alternative
- Writing your own forward_list<T> alternative
- Better memory management
- Summary
- Chapter 13: Writing Generic Containers with Implicit Memory Management
- Technical requirements
- Why explicit memory management complicates our implementation
- Implicit memory management with a smart pointer
- Consequences of this redesign
- Generalizing to ForwardList<T>?
- Summary
- Chapter 14: Writing Generic Containers with Allocator Support
- Technical requirements
- Why allocators?
- Traditional allocators
- Polymorphic memory resource allocators
- Summary
- Chapter 15: Contemporary Issues
- Technical requirements
- Starting object lifetime without constructors
- Trivial relocation
- Type-aware allocation and deallocation functions
- Summary
- Annexure: Things You Should Know
- Index
- Other Books You May Enjoy
مشخصات
نام کتاب
C++ Memory Management
نویسنده
Patrice Roy
انتشارات
Packt Publishing
تاریخ انتشار
2025
ISBN
9781805129806
تعداد صفحات
402
زبان
انگلیسی
فرمت
حجم
4.9MB
موضوع
C++ Core Concepts