AI Cyberspace
AI Cyberspace
Mar 25, 2023 · Fundamentals

Mastering C Memory Management: malloc, realloc, memset, memcpy & More

This article explains how C programs allocate, resize, initialize, and transfer memory using functions like malloc, free, realloc, memset, memcpy, memmove, and alloca, and provides coding standards to avoid out‑of‑bounds errors, leaks, and use‑after‑free bugs.

CMemcpyStack
0 likes · 11 min read
Mastering C Memory Management: malloc, realloc, memset, memcpy & More
360 Smart Cloud
360 Smart Cloud
Sep 25, 2019 · Fundamentals

Analyzing and Fixing realloc Memory Issues in WABT's wasm2c Component

This article examines the WABT project's wasm2c memory bug caused by improper use of realloc, explains two classic realloc pitfalls—failure detection and zero‑size allocation—provides safe coding patterns, and describes the submitted fix that has been merged into the main branch.

Bug FixC programmingWABT
0 likes · 5 min read
Analyzing and Fixing realloc Memory Issues in WABT's wasm2c Component