Page 1 of 1

NEW / DISPOSE and Memory Allocation

Posted: Thu Aug 09, 2012 8:32 am
by cfbsoftware
In addition to its regular use with normal RAM, Astrobe for Cortex-M3 allows you to use the standard NEW function to create and access dynamic records and arrays using non-CPU RAM .

This was initially developed to allow Astrobe users better access to the peripheral RAM on MCUs (like the extra 16Kb + 16Kb of AHB SRAM on the LPC1769). However, it could also be used with any RAM that is directly addressable in the same way as CPU RAM. By allowing you to specify the base address of the heap this can be moved out of CPU RAM which then has the added advantage that there is more stack space available as well.

We have also implemented a new language extension, a standard procedure DISPOSE, to reclaim dynamic memory. This and the existing standard procedure NEW have been implemented in a new library module 'Storage' (inspired by a similar feature in Modula-2). Consequently, users with the source code of the library modules will now be able to substitute their own functions for the supplied memory allocation / deallocation procedures invoked by NEW / DISPOSE. As well as allowing you to tailor the performance and efficiency of these functions to suit the requirements of particular projects there are additional benefits e.g. you could add memory usage tracing features.