Tagged articles
memory alignment
17 articles · Page 1 of 1
This article explains how false sharing occurs when independent threads modify variables on the same CPU cache line, triggering MESI protocol overhead that degrades performance, and covers detection methods using perf and VTune plus mitigation techniques like cache-line padding and thread-local storage.
CPU cacheMESI protocolcache line
0 likes · 22 min read

This article explains the core principles of memory alignment on Linux, shows how misaligned data harms CPU cache and execution speed, provides concrete C code examples and benchmark results, and offers practical techniques—including compiler directives and struct layout tricks—to achieve optimal performance.
Linuxc-programmingmemory alignment
0 likes · 22 min read

This article explains the natural alignment requirements of C/C++ data types, how structs are padded and aligned based on member alignments, the hardware, cache and compiler reasons for alignment, and the concept of over‑aligned types with practical examples and usage guidelines.
C++C++Compiler
0 likes · 11 min read

This article explains how memory alignment in Linux—driven by hardware granularity, kernel allocation policies, and compiler optimizations—affects struct layout, cross‑platform compatibility, and execution speed, and provides practical techniques and testing methods to ensure optimal performance and reliability.
Linuxc-programmingcross-platform
0 likes · 37 min read

This article explains the concept of memory alignment in Linux, how alignment rules affect struct layout and CPU access, why proper alignment improves performance and portability, and provides practical compiler directives and code examples for implementing and testing aligned data structures.
c-programmingmemory alignmentperformance optimization
0 likes · 27 min read

This article explains Go's memory alignment concepts, why alignment is needed, demonstrates real-world layout differences with examples, discusses performance and portability impacts, and introduces tools like fieldalignment and structlayout to detect and fix alignment issues in Go programs.
Structmemory alignmenttooling
0 likes · 14 min read

This article walks through C++ object memory layout using concrete examples, covering basic data members, methods, private and static members, inheritance (with and without virtual functions), compiler optimizations, and address‑space layout randomization, all demonstrated with GDB inspections and code snippets.
ASLRC++Inheritance
0 likes · 22 min read

This article presents a comprehensive C++ interview guide covering dynamic polymorphism, vtable mechanics, static vs virtual functions, memory alignment benefits, iterator invalidation in vector and map, erase‑remove idiom, map implementation details, and common synchronization primitives used in multithreaded programming.
C++MultithreadingSTL
0 likes · 12 min read

This guide explains C structs—from basic definitions and declaration styles to memory alignment, byte sizing, bit‑field handling, nested structures, and using structs as function parameters—providing clear code examples and practical tips for efficient embedded and systems programming.
C++EmbeddedInitialization
0 likes · 29 min read

The article explains how the JVM reduces memory consumption on 64‑bit systems by using compressed ordinary object pointers (compressed oops), describes pointer size, alignment and padding, shows C struct and JVM object layout examples, and demonstrates inspection tools like HSDB and XPocket for analyzing object memory footprints.
HSDBJVMJava
0 likes · 12 min read

This article explains how improper pointer usage and memory‑alignment violations in C can cause crashes on microcontrollers, demonstrates the issue with a concrete code example, and provides portable solutions such as byte‑wise access or memcpy to avoid unaligned accesses.
C++MCUMemcpy
0 likes · 6 min read

This article examines several subtle Go programming issues—including unexpected loop variable addresses, the scope nuances of the := operator, proper handling of goroutine concurrency with worker pools, and how struct field ordering affects memory alignment—providing code examples and practical solutions to avoid these pitfalls.
ConcurrencyGoLoop Variable
0 likes · 15 min read

This article introduces the PHP variable system by examining the Zend Engine's source code, covering variable naming rules, value types, reference and variable variables, file extensions in the PHP source tree, and a detailed walkthrough of the zend_types.h definitions, unions, structs, and memory‑alignment considerations.
BackendC languagePHP
0 likes · 32 min read

This article explains how the MNN deep‑learning framework leverages OpenCL to achieve high‑performance inference on mobile, PC and embedded GPUs by diversifying memory objects, aligning data, using local‑memory reductions, selecting optimal work‑group sizes, applying pre‑inference auto‑tuning, caching compiled programs, and providing practical GPU‑friendly model design guidelines.
GPU optimizationMNNOpenCL
0 likes · 20 min read

This article explains Go’s type size specifications and alignment guarantees, demonstrates how to compute a struct’s memory footprint using unsafe.Sizeof and unsafe.Alignof, walks through concrete examples with structs T and R, and shows how field ordering affects actual memory usage.
GoUnsafealignof
0 likes · 12 min read

This article explores how Objective‑C objects are converted to low‑level C/C++ structures, compares the results of class_getInstanceSize, malloc_size and sizeof, and explains memory‑alignment rules, member ordering, padding, and inheritance effects on the actual memory footprint of iOS objects.
Memory LayoutObjective-C++Runtime
0 likes · 22 min read

The article explains how memory chips are organized into banks and matrices, why eight consecutive bytes are distributed across eight banks for parallel I/O, and how this hardware design makes 64‑bit (8‑byte) alignment essential for optimal performance.
I/Obankshardware
0 likes · 5 min read
