Three GCC Flags for Analyzing Memory Usage

I learned about three new GCC compiler/linker flags this week that are helpful for monitoring a system’s memory usage. I was surprised that I hadn’t previously run across them, and it seems like other developers in my network didn’t know about these flags either! Perhaps this isn’t too out of the ordinary considering that two …

foonathan/memory: Simplifying the C++ Memory Allocator

The memory library is developed by Jonathan Müller, a C++ library developer and author of foonathan::blog(). This library provides an new STL-compatible C++ memory allocator called RawAllocator. The RawAllocator is similar to the standard Allocator but is easier to use. The library also provides a BlockAllocator type which can be used for allocating large blocks …

Implementing Malloc With FreeRTOS

Updated 20191019 In the past I’ve shared malloc implementations which are built using a first-fit free list and ThreadX. Today I’d like to share a malloc implementation based on another popular RTOS: FreeRTOS. Table of Contents: FreeRTOS Memory Allocation A Simple FreeRTOS malloc A Simple FreeRTOS free Heap Initialization with heap_5 Heap 5 Groundwork Adding …

Generating Aligned Memory

Embedded systems often have requirements for pointer alignment. These alignment requirements exist in many places, some including: General device/CPU requirements Unaligned access may generate a processor exception with registers that have strict alignment requirements Cache line size You don’t want to accidentally perform clean/invalidate operations on random data Peripheral hardware requirements DMA and USB peripherals …