The
following
table lists some of the properties
that enable you to configure static allocations for the generated
code. Setting any of these properties at a level higher than an individual
instance sets the default for all instances. For example, setting
a class property at the component level sets the default for all class
instances. In all cases, behavior is undefined if the actual number
of instances exceeds the maximum declared number.
| Property |
Subject
and metaclass |
Description |
| BaseNumberOfInstances |
<lang>_CG::Class CG::Event
|
Specifies
the size of the local heap memory pool allocated
for either: - Instances of the class (<lang>_CG::Class)
- Instances of the event (<lang>_CG::Event)
This property provides support for static
architectures found in hard real-time and safety-critical systems
without memory management capabilities during run time. All instances
of events are dynamically allocated during initialization.
Once allocated, the event queue for a thread remains
static in size.
Triggered operations use the
properties defined for events.
When the memory
pool is exhausted, an additional amount, specified by the AdditionalNumberOf
Instances property, is allocated.
Memory
pools for classes can be used only with the Flat statechart implementation
scheme.
|
| AdditionalNumberOfInstances |
<lang>_CG::Class CG::Event
|
Specifies
the number of instances or events for which memory
is allocated when the current pool is empty. |
| ProtectStaticMemoryPool |
CG::Class/Event |
Determines whether
to protect access to the allocated memory
pool using an operating system mutex to provide thread safety. |
| MaximumPendingEvents |
CG::Class |
Specifies the maximum
number of events that can be simultaneously
pending in the event queue of the active class. |
See the definition provided for
each property on
the applicable Properties tab of the Features
window.
Operating system mutexes should not be
used in situations
where events are generated in an interrupt handler. Set the value
of the ProtectStaticMemoryPool property to Cleared so
that mutexes are not used. It is up to you
to make sure that the memory pool is not thread-safe. The animation
framework is not subject to this restriction.
The
framework files include reachable code for both
dynamic and static allocation. Actual usage is based on the generated
code. Use of the GEN and gen macros
is the same for both modes.
Implementation of
fixed and bounded relations with
static arrays through the <lang>_CG:Relation::ImplementWithStaticArray property
implicitly uses static allocation apart from initialization.