MENU

C++ heap manager provides real time, deterministic performance

C++ heap manager provides real time, deterministic performance

Technology News |
By Nick Flaherty



Segger in Germany has developed a run time library and heap manager that provides real time, deterministic performance for C++ code in embedded designs.

One of the challenges of using C++ for real time embedded projects is the use of object oriented code. These objects allocate their own memory in the memory, which can be a problem for the memory heap manager.  

“The real-time allocator takes a constant time for both allocation and deallocation. To achieve this, the heap manager has no loops, is straightline code for all requests, and is “good fit” rather than “best fit”,” said Paul Curtis, senior developer at Segger, who was working on a chess program.

“C++ applications require a lot of memory allocation and deallocation behind the scenes, often without the programmer being aware of it,” said Rolf Segger, founder of Segger. “C++ applications especially see an enormous benefit from our new real-time heap manager. Embedded Studio is the first toolchain that I know of that guarantees fast, constant-time heap operations. These responses are extremely fast, bringing true real-time to embedded systems programmed in C++.”

The allocator uses a two-level segregate fit model, which suits microcontrollers, and occupies 664 bytes of code for initialisation, allocation, and deallocation facilities on an ARM Cortex-M4 microcontroller core. An allocation worst case is 125 executed instructions, and a deallocation 95 executed instructions on that processor, every time, says Curtis.

Related articles

The real-time heap is also not fragmented by requests of varying size, which helps with the performance. The allocator has been benchmarked on a 168 MHz Cortex-M4 core with a performance increase of 46% for the chess program.

The first version of the run time library was released last week in Segger’s Embedded Studio for all the common RISC-V 32-bit and 64-bit cores, including but not limited to RV64I, RV64E, RV64GC, RV32I, RV32IMA, RV32IMAC, RV32IMAF, RV32IMAFC, RV32G, RV32GC, RV32E, RV32EMA, RV32EMAC.

A version for ARM is set to be launched this week, and the allocator will also be available as a standalone runtime library called emRun++.

In addition, Embedded Studio now provides embedded developers with a C++17 Compiler and C++17 Standard Library, combining the emRun runtime and emFloat floating-point libraries.

www.segger.com

Related articles

Other articles on eeNews Europe

If you enjoyed this article, you will like the following ones: don't miss them by subscribing to :    eeNews on Google News

Share:

Linked Articles
10s