Issue 2: Pointers and Memory Management

“Pointers, the heart of programmers.” In the world of C++, pointers are an unavoidable “double-edged sword”—they are the core tool for efficient memory operations and system-level programming, but they also become the easiest pitfall for beginners due to direct memory address manipulation. From dynamic memory allocation to function callbacks, from the underlying implementation of arrays … Read more

Configuring Huge Pages for PostgreSQL on Linux

Huge pages are a Linux kernel feature that allocates larger memory pages (typically 2 MB or 1 GB instead of the normal 4 KB). PostgreSQL’s shared buffer pool and dynamic shared memory segments are often tens of gigabytes, and using huge pages reduces the number of pages the processor must manage. Fewer page‑table entries mean … Read more

Memory Detection Tool KASAN in the Linux Kernel (7) – Implementation Based on Slab

Technical experience sharing, welcome to follow and provide guidance. In the previous article, we detailed the layout of KASAN shadow memory. This article analyzes the implementation principles of KASAN under slab. kmem_cache Layout For the slab layout with KASAN enabled, the structure has undergone some changes, as shown below: struct kmem_cache { …… #ifdef CONFIG_KASAN … Read more

Linux Performance Tuning: In-Depth Analysis of Buffer and Cache

Buffer and Cache are present in the output of the free command: $ free total used free shared buff/cache available Mem: 8169348 263524 6875352 668 1030472 7611064 Swap: 0 0 0 Note that the output of free may vary between different versions. This output includes specific usage statistics for physical memory Mem and swap partition … Read more

Linux Performance Tuning: Memory Management

Memory management is one of the core functions of an operating system, primarily used to store applications, instructions, caches, and more. Processes, Virtual Memory, and Physical Memory Physical memory is relatively easy to understand; it refers to the amount of memory in a computer, such as 8GB or 16GB. Physical memory is also known as … Read more

KASAN (4) – Inline Instrumentation Analysis

Technical experience sharing, welcome to follow and provide guidance. In “KASAN (1) – Simple Practice”, we did not explain the configuration CONFIG_KASAN_INLINE in detail, but simply explained it based on the kernel documentation. Here, we will provide a detailed introduction to the inline detection process of KASAN based on practical analysis. What is INLINE Mode … Read more

String Operations in C Language for Embedded Development

String Operations in C Language String operations are a frequent knowledge point in embedded development, where data transmission often requires operations such as copying, concatenating, and splitting strings. This article organizes the commonly used API functions for string operations in C language for easy reference on basic usage. The following header files basically include all … Read more

Linux Kernel Memory Detection Tool KASAN (1) – Simple Practice

Technical experience sharing, welcome to follow and provide guidance. I briefly introduced KASAN in my article “Debugging Memory Leaks in the Kernel”. At that time, my understanding of the implementation principles of KASAN was still shallow. Recently, I plan to comprehensively learn and understand KASAN, and then consolidate my memory by writing this series of … Read more

How Does Python’s Garbage Collection Mechanism (GC) Work? An Analysis of Reference Counting and Generational Collection Principles

One day, the memory of the online server exploded. I stared at the monitoring chart, thinking that the code was clearly fine. After checking for a long time, I found out that it was actually a memory leak caused by circular references. Objects referencing each other caused Python’s reference counting mechanism to fail, and the … Read more

Delving into the Internal Implementation of Rust Vec: Unveiling Hidden Fields

Introduction When you open the Rust standard library documentation to view the definition of <span>Vec<T></span>, have you noticed that mysterious line <span>{ /* private fields */ }</span>? As Rust developers, we use Vec every day, but what exactly is hidden inside? Today, let’s dive deep into the source code of the Rust standard library, peeling … Read more