Tagged articles
56 articles
Page 1 of 1
Deepin Linux
Deepin Linux
Mar 5, 2026 · Fundamentals

Unveiling malloc: How C Allocates Memory Behind the Scenes

This comprehensive guide explains the inner workings of the C malloc function, covering memory layout, stack vs heap, glibc memory pools, system calls like brk/sbrk and mmap, allocation strategies, fragmentation, alignment, multithreading safety, and comparisons with calloc, realloc, and C++ new.

C programmingglibcheap management
0 likes · 53 min read
Unveiling malloc: How C Allocates Memory Behind the Scenes
Deepin Linux
Deepin Linux
Oct 28, 2025 · Fundamentals

Why kmalloc Is the Secret Weapon for Fast Kernel Memory Allocation

This article explains how the Linux kernel's kmalloc function provides fast, contiguous physical memory allocation using the slab allocator, covering its API, internal mechanisms, allocation flags, memory management strategies, common pitfalls, and practical kernel module examples for developers.

Linux kernelSlab Allocatorkernel-development
0 likes · 73 min read
Why kmalloc Is the Secret Weapon for Fast Kernel Memory Allocation
Liangxu Linux
Liangxu Linux
Aug 19, 2025 · Fundamentals

How malloc and free Work: Inside Dynamic Memory Allocation

This article explains the fundamentals of malloc and free, covering their signatures, how they interact with the brk/sbrk system calls, the structure of memory control blocks, multiple allocation strategies such as explicit free lists, segregated lists, buddy systems and tcmalloc, along with code examples and their trade‑offs.

C programmingFreedynamic memory
0 likes · 15 min read
How malloc and free Work: Inside Dynamic Memory Allocation
Liangxu Linux
Liangxu Linux
Apr 2, 2025 · Fundamentals

How Does malloc Actually Work? Inside a Simple Memory Allocator

This article explains why dynamic memory allocation is essential, models the heap as a parking lot, outlines the core challenges of implementing malloc and free, describes block headers, explores First Fit, Next Fit, and Best Fit strategies, and details splitting, internal fragmentation, and efficient coalescing using footers.

Systems Programmingallocation strategiesfragmentation
0 likes · 17 min read
How Does malloc Actually Work? Inside a Simple Memory Allocator
Xuanwu Backend Tech Stack
Xuanwu Backend Tech Stack
Mar 20, 2025 · Backend Development

Why Does Pointer Collision Cause Concurrency Bugs in Java and How to Fix It?

Pointer collision is an efficient memory allocation technique that can trigger severe concurrency problems in multithreaded Java environments, and this article explains the underlying causes, illustrates conflict scenarios, and presents common remedies such as CAS (Compare‑And‑Swap) and TLAB (Thread‑Local Allocation Buffer) with sample code.

CASJavaTLAB
0 likes · 6 min read
Why Does Pointer Collision Cause Concurrency Bugs in Java and How to Fix It?
Deepin Linux
Deepin Linux
Feb 27, 2025 · Fundamentals

Understanding malloc and free: Memory Allocation Mechanisms in C

This article explains how the C functions malloc and free allocate and release memory, covering stack vs heap, the brk and mmap system calls, fragmentation, header metadata, and why both allocation strategies are needed for efficient memory management.

C programmingFreeHeap
0 likes · 17 min read
Understanding malloc and free: Memory Allocation Mechanisms in C
Refining Core Development Skills
Refining Core Development Skills
Feb 19, 2025 · Operations

Linux Kernel Memory Detection via E820 Mechanism

This article explains how the Linux kernel detects physical memory during boot by leveraging the E820 mechanism, where firmware reports memory ranges via interrupt 15H, enabling the kernel to map usable memory addresses for subsequent allocation.

Boot ProcessE820Linux kernel
0 likes · 8 min read
Linux Kernel Memory Detection via E820 Mechanism
Deepin Linux
Deepin Linux
Feb 14, 2025 · Fundamentals

Understanding Jemalloc: Principles, Comparisons, and Optimization Practices

This article provides a comprehensive overview of Jemalloc, covering its architecture, memory allocation fundamentals, performance comparison with ptmalloc and tcmalloc, practical optimization cases across web, database, and big‑data workloads, and detailed configuration guidelines to improve memory efficiency and multithreaded performance.

Performance Optimizationfragmentationjemalloc
0 likes · 31 min read
Understanding Jemalloc: Principles, Comparisons, and Optimization Practices
Liangxu Linux
Liangxu Linux
Jan 16, 2025 · Fundamentals

Building a Simple malloc and Mark‑Sweep GC for the Linux Kernel

This guide walks through creating a 32‑bit Linux‑kernel memory allocator using a free‑list, implementing morecore and add_to_free_list functions, and then adding a basic mark‑and‑sweep garbage collector that scans heap, BSS, data segments and the stack to reclaim unused blocks.

C programmingGarbage CollectionLinux kernel
0 likes · 12 min read
Building a Simple malloc and Mark‑Sweep GC for the Linux Kernel
Deepin Linux
Deepin Linux
Dec 19, 2024 · Fundamentals

Understanding the Implementation and Mechanisms of the C malloc Function

This article explains the purpose, prototype, and usage of C's malloc function, delves into its underlying implementation using free‑list mechanisms, virtual‑memory translation, system calls like brk and mmap, and compares it with related functions such as calloc, realloc and new, while providing practical code examples and best‑practice guidelines.

CFreedynamic memory
0 likes · 32 min read
Understanding the Implementation and Mechanisms of the C malloc Function
Linux Kernel Journey
Linux Kernel Journey
Sep 12, 2024 · Fundamentals

Understanding Linux Memory Allocation: Fast Path vs. Slow Path in the Source Code

This article dissects the Linux kernel's page allocation mechanisms, explaining how alloc_pages() follows a fast‑path using low watermarks and falls back to a slow‑path that triggers kswapd, direct reclaim, and compaction, while also detailing the corresponding page‑freeing functions and their internal data structures.

Linux kernelbuddy allocatorcompaction
0 likes · 30 min read
Understanding Linux Memory Allocation: Fast Path vs. Slow Path in the Source Code
Aikesheng Open Source Community
Aikesheng Open Source Community
Aug 8, 2024 · Databases

Understanding LOG_DISK Resource Limits and Tenant Memory Allocation in OceanBase

This article analyzes why creating a resource pool with 4C12G fails in an OceanBase single‑node cluster despite sufficient CPU and memory, explains the relationship between LOG_DISK size and tenant memory, provides calculation formulas, verification steps, and practical recommendations to avoid LOG_DISK resource shortages.

Database AdministrationLOG_DISKOceanBase
0 likes · 11 min read
Understanding LOG_DISK Resource Limits and Tenant Memory Allocation in OceanBase
ITPUB
ITPUB
Jul 30, 2024 · Databases

Why PostgreSQL Reports ‘invalid memory alloc request size’ and How to Fix It

The article explains PostgreSQL's 1 GB memory allocation limit, shows how inserting large BYTEA values triggers the “invalid memory alloc request size” error, explores the underlying memory‑context code, and offers practical work‑arounds for migration from Oracle.

BYTEADatabase LimitsMaxAllocSize
0 likes · 8 min read
Why PostgreSQL Reports ‘invalid memory alloc request size’ and How to Fix It
Liangxu Linux
Liangxu Linux
Jul 13, 2024 · Fundamentals

How Does malloc Actually Allocate Memory? A Visual Walkthrough

This article explains what happens inside a computer when you request memory with malloc, covering the C standard library, compilation, memory layout, heap allocation, fragmentation, and how the operating system expands the heap using system calls.

C programmingHeapOperating System
0 likes · 6 min read
How Does malloc Actually Allocate Memory? A Visual Walkthrough
IT Services Circle
IT Services Circle
Mar 25, 2024 · Fundamentals

Greedy Interval Algorithm for Memory Allocation

The article explains a greedy interval‑based memory allocation problem, describes how to detect overlapping intervals, locate the smallest suitable free block within a 100‑byte heap, and provides a complete Python implementation that reads intervals, checks validity, and outputs the optimal allocation address.

algorithmic problemgreedy algorithminterval scheduling
0 likes · 6 min read
Greedy Interval Algorithm for Memory Allocation
37 Interactive Technology Team
37 Interactive Technology Team
Nov 20, 2023 · Fundamentals

What Are Stack and Heap?

The article explains Go’s stack and heap memory, showing that stack allocations are fast, LIFO‑ordered and compile‑time sized while heap allocations grow upward, require garbage collection, and occur when variables escape a function, urging developers to prefer stack use for better performance.

Garbage CollectionGoHeap
0 likes · 6 min read
What Are Stack and Heap?
Zhuanzhuan Tech
Zhuanzhuan Tech
Sep 14, 2023 · Fundamentals

Analysis and Comparison of ptmalloc and tcmalloc Memory Allocators on Linux

This article examines Linux memory management fundamentals, explains the brk/sbrk and mmap system calls, details the internal architectures, allocation and reclamation processes of ptmalloc and tcmalloc, analyzes key configuration parameters, and presents benchmark and production‑level results that demonstrate their impact on performance and memory usage.

BenchmarkLinuxTCMalloc
0 likes · 32 min read
Analysis and Comparison of ptmalloc and tcmalloc Memory Allocators on Linux
政采云技术
政采云技术
Sep 7, 2023 · Backend Development

Understanding Netty's Memory Management and Allocation Strategies

This article explains how Netty implements memory management by borrowing concepts from Jemalloc and Tcmalloc, detailing the hierarchy of arenas, chunks, pages and sub‑pages, the allocation algorithms for both large and small buffers, and the role of thread‑local caches in reducing fragmentation and improving performance.

Backend DevelopmentJavaMemory Management
0 likes · 24 min read
Understanding Netty's Memory Management and Allocation Strategies
ByteDance SYS Tech
ByteDance SYS Tech
May 26, 2023 · Fundamentals

Unlock Faster C++ Performance: Practical Jemalloc Optimization Techniques

This article explains the fundamentals of Linux memory allocation, introduces Jemalloc’s core algorithms and data structures, and provides concrete optimization steps—including arena tuning, tcache configuration, and slab size adjustments—to achieve measurable CPU savings in high‑concurrency C++ services.

ArenaC++jemalloc
0 likes · 19 min read
Unlock Faster C++ Performance: Practical Jemalloc Optimization Techniques
MaGe Linux Operations
MaGe Linux Operations
Nov 23, 2022 · Backend Development

Boost Go Performance 42% with One Tiny Change: Escape Analysis Explained

An accidental discovery by a GitHub engineer revealed that moving a single '&' operator in a Go program eliminated unnecessary copies, reduced heap allocations via escape analysis, and improved execution speed by 42%, highlighting common pitfalls in Go’s regex engine, malloc, and garbage collection.

Backend DevelopmentEscape AnalysisGo
0 likes · 5 min read
Boost Go Performance 42% with One Tiny Change: Escape Analysis Explained
ByteDance Web Infra
ByteDance Web Infra
Aug 19, 2022 · Fundamentals

In‑Depth Analysis of dlmalloc, jemalloc, Scudo, and PartitionAlloc for Virtual‑Machine Memory Management

This article examines the design goals, key implementation details, strengths and weaknesses of four widely used memory allocators—dlmalloc, jemalloc, Scudo, and PartitionAlloc—highlighting how they address fragmentation, performance, and security in virtual‑machine runtimes and offering guidance for building efficient, safe allocators.

Scudodlmallocjemalloc
0 likes · 27 min read
In‑Depth Analysis of dlmalloc, jemalloc, Scudo, and PartitionAlloc for Virtual‑Machine Memory Management
Alibaba Terminal Technology
Alibaba Terminal Technology
Mar 28, 2022 · Backend Development

hyengine: Unifying Mobile Script Execution with JIT and Multi‑Language Support

This article introduces hyengine, a lightweight, high‑performance engine designed to run multiple scripting languages such as JavaScript, WebAssembly, and Python on mobile devices, detailing its architecture, JIT compilation, optimizer passes, memory allocator, garbage collector, and performance benchmarks compared to LLVM and other runtimes.

Garbage CollectionJITMobile
0 likes · 36 min read
hyengine: Unifying Mobile Script Execution with JIT and Multi‑Language Support
Baidu Intelligent Testing
Baidu Intelligent Testing
Jul 22, 2021 · Backend Development

Performance Optimization Techniques for Baidu C++ Backend Services: Memory Access, Allocation, and Concurrency

This article presents a comprehensive collection of Baidu C++ engineers' performance‑optimization practices, covering memory‑access patterns, string handling, protobuf manipulation, allocator choices, job‑level memory arenas, cache‑line considerations, and memory‑order semantics to achieve substantial latency and cost reductions in large‑scale backend services.

Backend Developmentconcurrencymemory allocation
0 likes · 32 min read
Performance Optimization Techniques for Baidu C++ Backend Services: Memory Access, Allocation, and Concurrency
Tencent Cloud Developer
Tencent Cloud Developer
Jun 3, 2021 · Backend Development

Understanding Go's Memory Allocation: From Assembly Debugging to Runtime Components

The article walks through Go’s memory allocator by first demonstrating assembly‑level debugging with Delve, then detailing its TCMalloc‑inspired design where tiny, small, and large objects follow distinct paths through per‑P caches, central spans, and the global heap, highlighting the roles of mcache, mcentral, mspan, and mheap.

AssemblyDebuggingGo
0 likes · 28 min read
Understanding Go's Memory Allocation: From Assembly Debugging to Runtime Components
Liangxu Linux
Liangxu Linux
May 9, 2021 · Fundamentals

How Linux Allocates Heap Memory: Inside vm_area_struct and the brk System Call

This article explains the Linux kernel's heap memory allocation process, covering the vm_area_struct and mm_struct data structures, the brk system call implementation, and the page‑fault handling that maps virtual addresses to physical memory, while also mentioning other allocation mechanisms such as mmap and HugePages.

HeapLinux kernelPage Fault
0 likes · 12 min read
How Linux Allocates Heap Memory: Inside vm_area_struct and the brk System Call
High Availability Architecture
High Availability Architecture
Apr 29, 2021 · Backend Development

C++ Backend Performance Optimization at Baidu: Memory Access, Allocation, and Concurrency Techniques

This article shares Baidu C++ engineers' practical performance‑optimisation techniques, covering memory‑access patterns, custom allocation strategies, string handling, protobuf handling, cache‑line considerations and memory‑order semantics to achieve significant latency and cost reductions in large‑scale backend services.

Backend DevelopmentPerformance Optimizationmemory allocation
0 likes · 32 min read
C++ Backend Performance Optimization at Baidu: Memory Access, Allocation, and Concurrency Techniques
21CTO
21CTO
Apr 24, 2021 · Backend Development

Unlocking C++ Performance: Surprising Memory‑Access Tricks from Baidu Engineers

This article explores Baidu C++ engineers' deep‑dive into performance optimization, covering memory‑access patterns, string‑buffer handling, protobuf merging, malloc strategies, job‑arena allocation, cache‑line effects, and modern memory‑order semantics to achieve multi‑fold speedups in large‑scale backend services.

Backend DevelopmentC++Performance Optimization
0 likes · 33 min read
Unlocking C++ Performance: Surprising Memory‑Access Tricks from Baidu Engineers
Baidu Geek Talk
Baidu Geek Talk
Apr 21, 2021 · Backend Development

Performance Optimization in Baidu's C++ Backend: Memory Allocation and Access Techniques

Baidu engineers boost C++ backend latency and cost efficiency by eliminating unnecessary string zero‑initialization, using zero‑copy split with SIMD, replacing deep protobuf merges with repeated string fields, employing job‑scoped arenas and custom memory resources for allocation, and applying prefetching, cache‑line awareness, and tuned memory‑order semantics, achieving multiplicative to order‑of‑magnitude speedups.

Memory AccessPerformance Optimizationcache line
0 likes · 31 min read
Performance Optimization in Baidu's C++ Backend: Memory Allocation and Access Techniques
iQIYI Technical Product Team
iQIYI Technical Product Team
Nov 27, 2020 · Artificial Intelligence

Optimizing TensorFlow Serving Model Hot‑Update to Eliminate Latency Spikes in CTR Recommendation Systems

By adding model warm‑up files, separating load/unload threads, switching to the Jemalloc allocator, and isolating TensorFlow’s parameter memory from RPC request buffers, iQIYI’s engineers reduced TensorFlow Serving hot‑update latency spikes in high‑throughput CTR recommendation services from over 120 ms to about 2 ms, eliminating jitter.

Model Hot UpdateTensorFlow ServingWarmup
0 likes · 11 min read
Optimizing TensorFlow Serving Model Hot‑Update to Eliminate Latency Spikes in CTR Recommendation Systems
360 Tech Engineering
360 Tech Engineering
Nov 16, 2020 · Backend Development

Understanding Go's Escape Analysis and Its Impact on Memory Allocation

Go's escape analysis determines whether variables are allocated on the stack or heap, influencing garbage collection overhead; this guide explains the analysis principles, shows how to enable compiler logs, and demonstrates through multiple code examples how different patterns cause or avoid variable escape.

Compiler FlagsEscape AnalysisGo
0 likes · 8 min read
Understanding Go's Escape Analysis and Its Impact on Memory Allocation
JD Retail Technology
JD Retail Technology
Oct 20, 2020 · Fundamentals

Understanding the Object Creation Process in Objective‑C

This article explains how Objective‑C creates objects by detailing the two creation methods, the internal alloc and init implementations, the callAlloc workflow, memory allocation, and the final binding of the isa pointer, with full source code excerpts for each step.

Object CreationObjective‑CRuntime
0 likes · 11 min read
Understanding the Object Creation Process in Objective‑C
Programmer DD
Programmer DD
Aug 17, 2020 · Fundamentals

JVM Object Creation: Memory Allocation, Layout, and Access Explained

This article explains the JVM's process for creating a Java object, covering class loading checks, memory allocation strategies such as bump-pointer and free list, thread-safe allocation mechanisms, object header composition, instance data layout, padding, and the ways references locate objects via handles or direct pointers.

JVMObject CreationObject Layout
0 likes · 7 min read
JVM Object Creation: Memory Allocation, Layout, and Access Explained
ITPUB
ITPUB
Nov 7, 2016 · Databases

Inside MySQL’s MEM_ROOT: How Memory Allocation Really Works

This article provides an in‑depth technical walkthrough of MySQL’s MEM_ROOT memory allocator, covering the key macros, the MEM_ROOT and USED_MEM structures, initialization and allocation routines, pointer‑manipulation logic, and the heuristic algorithm that grows block sizes as usage increases.

CDatabase InternalsMEM_ROOT
0 likes · 8 min read
Inside MySQL’s MEM_ROOT: How Memory Allocation Really Works
ITPUB
ITPUB
Apr 12, 2016 · Backend Development

Understanding MySQL’s MEM_ROOT: Structure, Macros, and Allocation Mechanics

This article explains MySQL's widely used MEM_ROOT memory allocator, detailing its macros, the MEM_ROOT and USED_MEM structures, initialization routine, allocation algorithm, and pointer handling, while illustrating how free and used blocks are managed via linked lists.

Backend DevelopmentCMEM_ROOT
0 likes · 8 min read
Understanding MySQL’s MEM_ROOT: Structure, Macros, and Allocation Mechanics