ByteDance C++ Second Interview: Implementing shared_ptr from Scratch

ByteDance C++ Second Interview: Implementing shared_ptr from Scratch

In the field of C++ development, smart pointers are an extremely important mechanism that greatly enhances the safety and convenience of memory management. Among them, shared_ptr is a key member of the smart pointer family, which uses reference counting to allow multiple pointers to share ownership of the same object. When the last shared_ptr pointing … Read more

Goodbye malloc/free: C++’s More Powerful Memory Management with new/delete

Goodbye malloc/free: C++'s More Powerful Memory Management with new/delete

In C, we often use the functions malloc and free for manual memory allocation and management. However, in C++, two operators, new and delete, are specifically designed to assist programmers in memory allocation and management, significantly simplifying memory management operations, especially for class objects. The new/delete operations are essential and should be learned and mastered. … Read more

Chapter 25 of ‘Getting Started with FreeRTOS’: Practical Memory Leak Detection

Chapter 25 of 'Getting Started with FreeRTOS': Practical Memory Leak Detection

Table of Contents Course Objectives 1. Custom malloc/free Hook Functions 1.1 Basics of FreeRTOS Memory Management 1.2 Principles of Hook Function Implementation 1.3 Practical: Implementation of Memory Tracking Hook 2. Memory Fragmentation Monitoring Solutions 2.1 Causes of Memory Fragmentation 2.2 Fragmentation Detection Methods 2.3 Comparison Table of Optimization Strategies Practical Project: Memory Monitoring System 3.1 … Read more

FreeRTOS Learning: System Porting

FreeRTOS Learning: System Porting

Scan to FollowLearn Embedded Together, learn and grow together This series of articles on FreeRTOS aims to help beginners quickly get started and master the basic principles and usage methods of FreeRTOS while organizing knowledge for themselves. FreeRTOS Quick Start – Initial Exploration of the System FreeRTOS Official Chinese Website is Now Live FreeRTOS Coding … Read more

What is Memory in Embedded Operating Systems?

What is Memory in Embedded Operating Systems?

Follow and star our public account to access exciting content Source: Online materials Key content: ☆ Linux memory organization structure and page layout, causes of memory fragmentation and optimization algorithms. ☆ Various memory management methods in the Linux kernel, memory usage scenarios, and pitfalls in memory usage. ☆ From the principles and structure of memory … Read more

Advanced Uses of Embedded C You Should Know

Advanced Uses of Embedded C You Should Know

01 Memory Management We need to understand that variables are essentially just abstract names for memory addresses. In statically compiled programs, all variable names are converted to memory addresses at compile time. The machine does not recognize the names we use; it only knows the addresses. Memory usage is one of the important factors to … Read more

The Rust Safety Declaration: Breaking the 30-Year Memory Management Dilemma

The Rust Safety Declaration: Breaking the 30-Year Memory Management Dilemma

1 Blood and Tears: The Tragedy of 30 Years of Memory Management1.1 Dangling Pointers: The Ghostly Code KillerIn 2014, a financial trading system experienced a memory leak in C++ that caused daily trading delays to soar from 200ms to 15 seconds, resulting in a direct loss of 230 million. Post-analysis revealed that an unreleased std::vector … Read more

In-Depth Analysis of Raw One-Dimensional Arrays in C++ – The Starting Point for Efficient Memory Management

In-Depth Analysis of Raw One-Dimensional Arrays in C++ - The Starting Point for Efficient Memory Management

Learning C++ involves mastering data structures, which are core to the language. Among these, <span><span>raw arrays</span></span> are one of the most fundamental and efficient ways to organize data, serving as the starting point for understanding more complex containers like <span><span>vector</span></span> and <span><span>list</span></span>. Today, we will thoroughly understand raw arrays in C++ and learn how to … Read more

Introduction to Linux Virtual Memory Management

Introduction to Linux Virtual Memory Management

Once a program is running, it becomes a process. Regardless of whether it is in kernel mode or user mode, the process sees a virtual memory space. When accessing specific data, the virtual memory address is first converted to a physical memory address, allowing access to the actual physical memory where this data is stored, … Read more