What problem does it solve?
This Skill addresses the critical challenge of memory safety in programming, helping developers prevent common bugs like memory leaks, use-after-free errors, and buffer overflows.
Core Features & Use Cases
- Cross-Language Patterns: Provides guidance on memory safety techniques applicable to Rust, C++, and C.
- RAII and Ownership: Explains Resource Acquisition Is Initialization (RAII) and Rust's ownership model for deterministic resource management.
- Smart Pointers: Details the use of
unique_ptr, shared_ptr, and weak_ptr in C++ for safer memory handling.
- Bounds Checking: Emphasizes safe array and vector access in C++ and Rust.
- Data Race Prevention: Covers techniques like mutexes, atomics, and Rust's concurrency primitives.
- Use Case: When developing a high-performance systems application in C++ or Rust, ensuring memory safety is paramount to prevent crashes and security vulnerabilities. This skill provides the patterns and best practices to achieve that.
Quick Start
Use the memory-safety-patterns skill to explain RAII in C++ with an example.