Guide to Dynamic Memory Usage in FreeRTOS: Choosing Between malloc and pvPortMalloc

Guide to Dynamic Memory Usage in FreeRTOS: Choosing Between malloc and pvPortMalloc

In embedded development, you might write something like this: uint8_t* buf = malloc(1024); // Allocate 1KB of memory It seems convenient, but in a multitasking system like FreeRTOS, there are some details regarding memory management that need attention. Differences Between malloc Heap and FreeRTOS Heap Feature malloc / free pvPortMalloc / vPortFree Heap Source C … Read more

Discussing C Programming: The Relationship Between C Language and Memory

Discussing C Programming: The Relationship Between C Language and Memory

The association between memory and data types is the core logic of the underlying design of the C language, and their relationship can be summarized as: Memory provides physical storage space, while data types are the logical abstraction and access rules for that storage space. The following analysis will unfold from three dimensions: memory characteristics, … Read more

Learning Notes on C Language Pointers

Learning Notes on C Language Pointers

Click to follow the above “Stephen“, Set as “Starred”, to receive valuable content promptly Introduction The pointer is one of the most important and also the most difficult concepts in the C language. It is not only a core feature of C but also the foundation for many advanced programming techniques. This tutorial will start … 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

ESP32 Performance Optimization Strategies: Memory Management Optimization

ESP32 Performance Optimization Strategies: Memory Management Optimization

In ESP32 development, optimizing memory management is a key aspect of enhancing system performance and stability. Below are some memory management optimization strategies based on ESP32 features and common issues, covering heap memory configuration, peripheral optimization, static allocation, task stack management, and more: 1. Heap Memory Management Optimization 1.1 Initialize Heap Memory Manager ESP-IDF provides … Read more

LWMEM: A Powerful Memory Management Tool for Embedded Systems

LWMEM: A Powerful Memory Management Tool for Embedded Systems

In embedded system development, memory management has always been a headache for developers. Issues like memory fragmentation and memory leaks not only affect system performance but can even lead to system crashes. Traditional memory management solutions are often too complex and difficult to adapt to the resource constraints of embedded systems. Now, there is a … Read more

Memory Allocators in FreeRTOS: heap1 to heap5 (Part 3)

Memory Allocators in FreeRTOS: heap1 to heap5 (Part 3)

heap1   Design Concept  Using fixed-size memory blocks divided into multiple equal-sized memory blocks.      Usage Process   1  Initialization  2  Call  Using xNextFreeByte as a marker, find the starting address of the unallocated bytes and return the byte position 3  Release  Not supported Understanding pvPortMalloc()   Memory allocation needs to consider two aspects of byte alignment     1  Memory allocation byte alignment  2  Memory heap starting address byte alignment   … Read more

Can’t Define Variable Length Arrays in C? Don’t Be Ridiculous!

Can't Define Variable Length Arrays in C? Don't Be Ridiculous!

Hello everyone, I am Xiaokang. Today, let’s talk about a severely misunderstood feature of the C language—Variable Length Arrays! Have you heard the saying “You can’t define variable length arrays in C”? If you believed that, you have been seriously misled! Today, we will expose this widely spread “lie” and get to the bottom of … Read more

C Language Arrays: From Beginner to Mastery – A Comprehensive Guide

C Language Arrays: From Beginner to Mastery - A Comprehensive Guide

Recent Hot Articles 2025 Latest C Language Learning Path | Beginner, Intermediate, Practical C Language Functions: From Beginner to Mastery – A Comprehensive Guide C Language Pointers: From Beginner to Mastery – A Comprehensive Guide C Language Learning Guide: Have You Mastered These Core Knowledge Points? Beginner’s Guide to Avoiding Pitfalls in C Language: Avoid … Read more

Essential Knowledge for Programmers: Flexible Arrays in C Language Made Simple!

Essential Knowledge for Programmers: Flexible Arrays in C Language Made Simple!

Hello everyone, I am Xiaokang. Today, let’s talk about a seemingly sophisticated yet super practical concept in C language—flexible arrays. Don’t be intimidated by the name; what does “flexible” mean? Simply put, it refers to an array with variable size and undefined length. Mastering this technique can significantly enhance your programming skills! ⚡ Friendly Reminder: … Read more