»Click here to view online I »Forward to a friend I »Sign up for an Embedded Newsletter

Share this Newsletter:

facebook linkedin twitter digg

October 22, 2012

Tech Focus

Efficient and bug-free memory management

Mastering stack and heap for system reliability: Part 1 – Calculating stack size

Mastering stack and heap for system reliability: Part 2 - Properly allocating stacks

Mastering stack and heap for system reliability: Part 3 - Avoiding heap errors

Editor's Note

Bernard Cole Bernard Cole
Site Editor
Read his blog

As long as there have been embedded systems, the constrained resource nature of the typical design makes efficient, effective, and bug-free memory management a top priority. Because there is only so much memory to go around, much of a programmer's time and effort is spent on coming up with better ways to move data and instructions into and out of memory quickly, efficiently and with a minimum of errors.

In "Mastering stack and heap for system reliability," a three part series by Anders Lundgren and Lotta Firmanson of IAR Systems, the authors take you step by step through the techniques for allocating stack and heap in ways that ensure you'll have a robust design that optimizes use of memory resources.

To complement their series of tutorials, here are the links to a variety of design articles, technical and white papers, and webinars on this topic. Of these my Editor's Top Picks are:

Memory allocation in C
Improving performance for dynamic memory allocation
Memory allocation and fragmentation in C & C++

In the Insight section regular columnists Jack Ganssle and Dan Saks provide their perspective on this topic. And in Resources Around the Network are a number of conference papers and journal articles on the latest techniques in embedded system memory management.

(Editor's Note: If you have an idea for a project or a topic you would like to share with other embedded system developers at the spring ESC Silicon Valley in April, 2013, submit an abstract . Deadline is Nov. 2. And if they are not interested, give me a call at 928-525-9087 or email me.)


Memory allocation in C

Dynamic memory allocation and the structures that implement it in C are so universal that they're sometimes treated as a black box. In the real world of embedded systems, that may not be desirable or even possible. (This article first appeared in the August 1989 issue of Embedded Systems Programming magazine. )

Dynamic allocation in C and C++

C and C++ have strikingly different approaches to managing dynamic memory.

The yin and yang of dynamic allocation

Despite its risks, dynamic memory allocation is a valuable facility that you shouldn't blindly disregard.

Improving performance for dynamic memory allocation

To heap or not to heap need no longer be the question. Nor is dynamic versus static your only choice in allocating memory in constrained embedded designs.

Destruction aids memory management in object-oriented C

Proper memory management is a key component of any successful object-oriented application. This article addresses the relevant issues, with a focus on the object-oriented C programming scheme previously demonstrated.

Building a user space library for dynamic memory analysis

Amarender Barrenkala describes simple straightforward technique for building a user space library for dynamic memory analysis and provides some examples of how it can be used.

Deterministic dynamic memory allocation & fragmentation in C & C++

Colin Walls details the problems with dynamic memory allocation, which tends to be non-deterministic, leading to unexpected allocation failures and describes an approach that resolves such issues.

Tackling memory allocation in multicore and multithreaded applications

Embedded database experts from McObject describe how to build a custom memory manager to avoid the locking conflicts that often occur in multithreaded or multicore designs with two or more processors.

Practical Ada Memory Management Strategies for Real-Time Systems

If an embedded-systems programmer uses Ada long enough, he or she will undoubtably need to represent a variable-sized data structure, possibly at an address determined at runtime. Links between such structures may also be necessary, and the programmer may finally break down and attempt to use pointers.

Allocating memory in MATLAB-to-C code

MATLAB frees you from having to think about memory allocation and actively encourages the use of variable-size arrays. But memory, time, and hardware constraints limit how the C implementation allocates memory. Here are some workarounds.


Poly-Platform 2.0 features enhanced memory management for multicore apps

PolyCore Software, Inc. (PSI) has added significant functionality to Version 2.0 of its Poly-Platform multicore software platform.

Coverity raises static analysis for codes a notch

The concept of Boolean satisfiability is being applied to identify "bugs" in software code.

DESIGN East - LDRArules programming rule checker assures standards compliance

LDRArules is a programming rule checker that brings together a collection of rules from a broad spectrum of programming standards.

LDRA tool suite integrates MISRA AC for verification of auto-generated code

LDRA's MISRA AC provides independent verification of the auto-generated code, a critical factor in stringent certification requirements.


FRAM helps TI cut power for Wolverine MSP430 platform

Wolverine is the moniker chosen by Texas Instruments for an ultra-low-power MSP430 microcontroller platform launched here which provides 360 nA real-time clock mode - more than doubling battery life - and less than 100 μA/MHz active power consumption.

Code base growth drives static analysis market

Embedded software engineers using a static analysis tool are working on projects with significantly larger average numbers of in-house developed lines of software code than developers not using a static analysis tools according to research by VDC Research.

LDRA tool suite supports integration with VisualDSP++

LDRA has integrated its tools suite with the Analog Devices VisualDSP++ (VDSP++) software development environment. The tool suite provides automated software testing and verification across all stages of software development.


Allocating arrays

The distinction between allocating arrays and allocating raw storage is useful and worth preserving whether you program in C or C++.

Stack management

It's tough to estimate stack size. Now it appears that at least one tool can help

More on Memory Leaks

The best way to detect memory leaks is to use a smarter memory allocator. That turns out to be easier than you might think.

Flushing out memory leaks

Before you can plug memory leaks, you have to find them. These tools can help.

Preventing dynamic allocation

Here's a simple technique to generate a warning that your C++ code is using dynamic allocation against your wishes.<<>

Collections on Embedded.com

Embedded.com now has a series of collections of content by topic. We will continue to add content to our collections and will have a rating system in the near future where you can rate your favorite articles (and help others find them). To suggest new collections or to suggest content to add to a collection, contact Susan Rambo, managing editor.

New collection:

Best practices in embedded systems programming

Browse the collections:

A sampling of topics include:
PID control
Digital signal processing
Agile programming
Watch Dog Timers

TechOnline Library

Tech Papers

Memory Management: Part 1

Memory Management: Part 2

Efficient memory management for multithreading DSP applications

Stack Usage Checking

SVA Local Variable Coding Guidelines for Efficient Use

Webinars & Courses

Memory Flaws Boot Camp

Considerations for Implementing an Embedded Memory Subsystem in Graphic Applications

Maximizing off-chip memory performance, the great CPU and GPU balancing act

ESC SV-528- Guide to Adopting Static Source Analysis


Around the Network Events

Versatile stack management for multitasking sensor networks

Memory allocation strategies for RTOSes used in embedded devices

Memory Management for Multimedia QoS in Resource Constrained Embedded Systems

Efficient dynamic heap allocation of scratch-pad memory

Heap management for limited local memory multi-core processors

1µA Op Amp, Comp & VRef
Touchstone's new TS12011/12 ICs combine a rail-to-rail op amp, comparator and 0.6V reference into a TDFN-22 package. Using only 1.6µA Icc max, the TS12011 has a push pull output; the TS12012 has an open drain output. Free demo boards. Available now.
Learn more...

Conferences and Events

ESC Silicon Valley Call for Abstracts
Deadline is November 2, 2012:
The Embedded Systems Conference (now part of DESIGN West) is soliciting proposals from speakers with deep technical expertise for the technical conference program and speed-training theater sessions at the ESC Silicon Valley 2013 (April 22 through 25 in San Jose, California). "This year for the first time we're actively soliciting real-world case studies, talks that include demos, and all elements of the design cycle--from concept through to production." says Karen Field, interim conference director.

ESC tracks include:
--Connectivity and networking
--Debugging and test
--Embedded Android
--"Hello World": focused on the latest hardware and software development tools
--Hardware: Design, I/O, and Interfacing
--Linux Kernel and operating systems
--Low-Power design
--Processors and programmable devices
--Real time operating systems
--Safety, security & hacking embedded systems
--Systems design

For more info on tracks and submitting, click here. Submit proposals by November 2, 2012.

Mark your calendar

Registration is now open for Embedded Systems Conference 2013 (part of DESIGN West), to be held April 22 to 25, 2013 at the McEnery Convention Center, San Jose, CA. Super-early pricing available now (save $800 on All-Access Pass).

ARM TechCon 2012 is October 30 through November 1, 2012 at the Santa Clara Convention Center, Santa Clara, CA.
Oct. 30 is Chip Design Day
Oct. 31 through Nov. 1 are the Software & Systems Design Days
Tracks include:
--Android / open source
--Compute platforms
--Developing & debugging
--Low-power design
--Microcontroller and programmable platforms
--Multimedia processing
--Networking & connectivity
--Safety & security
--Software optimization on ARM-powered systems
--The fundamentals of ARM

For more industry events, visit Embedded.com's event page.

This email was sent to: @{Email Name}@

To subscribe to UBM Electronics emails or change your email preferences please click here.

Go to Embedded.com
A UBM Electronics Newsletter © 2012. All rights reserved.
Privacy Policy I Advertising Information I Unsubscribe
UBM Electronics, 303 Second Street, Suite 900 South, San Francisco, CA 94107