Tag

smart pointers

1 views collected around this technical thread.

Deepin Linux
Deepin Linux
Dec 26, 2024 · Fundamentals

Understanding C++ Smart Pointers: Types, Mechanisms, and Best Practices

This article explains how C++ smart pointers—unique_ptr, shared_ptr, weak_ptr and the deprecated auto_ptr—use RAII and reference‑counting to automate memory management, avoid leaks and dangling pointers, and provide guidelines, performance analysis, and practical usage tips for modern C++ development.

C++Memory ManagementRAII
0 likes · 36 min read
Understanding C++ Smart Pointers: Types, Mechanisms, and Best Practices
Deepin Linux
Deepin Linux
Sep 4, 2024 · Fundamentals

Comprehensive Overview of C/C++ Language Features, Standard Library, and Object‑Oriented Concepts

This article provides an extensive guide to C/C++ fundamentals, covering static and const qualifiers, references versus pointers, memory‑management techniques, STL container implementations, iterator behavior, object‑oriented principles, virtual functions, smart pointers, and modern C++11 features for both beginner and experienced developers.

C++C++11Memory Management
0 likes · 44 min read
Comprehensive Overview of C/C++ Language Features, Standard Library, and Object‑Oriented Concepts
Deepin Linux
Deepin Linux
Aug 26, 2024 · Fundamentals

Understanding and Preventing Memory Leaks in C++ Applications

The article explains what memory leaks are, common causes, and presents practical techniques such as avoiding heap allocations, using smart pointers, employing arena allocators, leveraging coroutines, applying RAII, and debugging with tools like gperftools to detect and resolve leaks in C++ programs.

C++CoroutineMemory Leak
0 likes · 12 min read
Understanding and Preventing Memory Leaks in C++ Applications
Deepin Linux
Deepin Linux
Aug 13, 2024 · Fundamentals

C++ Interview Topics: Smart Pointers, Memory Management, Polymorphism, and More

This article provides a comprehensive overview of common C++ interview questions, covering smart pointer implementations, memory management techniques, object-oriented concepts such as polymorphism and virtual functions, STL containers, threading, and modern C++ features like move semantics and coroutines.

C++ConcurrencyMemory Management
0 likes · 64 min read
C++ Interview Topics: Smart Pointers, Memory Management, Polymorphism, and More
Deepin Linux
Deepin Linux
Apr 18, 2024 · Fundamentals

C++ Memory Management: Concepts, Pitfalls, and Best Practices

This article provides a comprehensive overview of C++ memory management, covering stack vs heap allocation, deep vs shallow copying, common errors such as leaks, dangling pointers, double frees, and offers practical techniques like custom new/delete overloads, smart pointers, RAII, and tools for detecting memory problems.

C++Leak DetectionMemory Management
0 likes · 92 min read
C++ Memory Management: Concepts, Pitfalls, and Best Practices
Deepin Linux
Deepin Linux
Nov 3, 2023 · Fundamentals

C++11 New Features and Their Practical Usage

This article provides a comprehensive overview of C++11 enhancements, including list initialization, type deduction, constexpr, move semantics, perfect forwarding, lambda expressions, smart pointers, and new casting rules, with detailed explanations and code examples illustrating their syntax, behavior, and practical applications.

C++11Lambda Expressionscasting
0 likes · 61 min read
C++11 New Features and Their Practical Usage
Tencent Cloud Developer
Tencent Cloud Developer
Jan 4, 2022 · Fundamentals

Smart Pointers in C++: Problems Solved, Usage, Best Practices, and Implementation Details

C++11 smart pointers—unique_ptr, shared_ptr, and weak_ptr—replace manual new/delete by providing exclusive, shared, and non‑owning ownership semantics, automatically preventing leaks and dangling references, simplifying multithreaded code, and, when used with best‑practice guidelines, avoid common pitfalls such as double deletions and cyclic dependencies.

C++Memory ManagementMultithreading
0 likes · 24 min read
Smart Pointers in C++: Problems Solved, Usage, Best Practices, and Implementation Details