Real-Time Workshop | ![]() ![]() |
The real-time malloc
code format (corresponding to the generic real-time malloc
target) is very similar to the real-time code format. The differences are:
malloc
calls are limited to the model initialization code. Generated code is designed to be free from memory leaks, provided that the model termination function is called.
malloc
allows you to multiply instance the same model with each instance maintaining its own unique data.
malloc
allows you to combine multiple models together in one executable. For example, to integrate two models into one larger executable, real-time malloc
maintains a unique instance of each of the two models. If you do not use the real-time malloc
format, the Real-Time Workshop will not necessarily create uniquely named data structures for each model, potentially resulting in name clashes.
grt_malloc_main.c
, the main routine for the generic real-time malloc
(grt_malloc
) target, supports one model by default.
See Combining Multiple Models for information on modifying grt_malloc_main
to support multiple models. grt_malloc_main.c
is located in the directory matlabroot/rtw/c/grt_malloc
.
Unsupported Blocks
The real-time malloc
format does not support the following built-in blocks, as shown:
System Target Files
Template Makefiles
grt_malloc
grt_malloc_bc.tmf
-- Borland C
grt_malloc_vc.tmf
-- Visual C
grt_malloc_watc.tmf
-- Watcom C
grt_malloc_lcc.tmf
-- LCC compiler
grt_malloc_unix.tmf
-- UNIX host
tornado.tmf
![]() | Real-Time Code Format | S-Function Code Format | ![]() |