High Water Marks

In order to understand the mechanism of highwater marks, you need to understand the generated code for an SW-C and some data structures of the ARXF-CP. The highwater marks can be used to finetune the RXF Configuration of your memory pools.

These pools are used to allocate dynamically objects, for example events. If an event has parameters, the resulting event structure is larger. When calling RXF_MemoryManager_getMemory(), depending on the requested size, a specific memory pool will be used.
All ‘global’ data is allocated within a RXF_SWC structure: per Rhapsody instance of an SW-C this RXF_SWC structure is instantiated, which includes these pools. You can use an highwater mark to verify how much which pool is actually used and by adjusting the number of blocks and size of blocks for the various memory pools, you can use the static allocated storage more efficiently.

The generated code for an SW-C can look like:

By understanding the generated code for your model, you can use a debugger to inspect a RXF_SWC structure at runtime.

The following illustration shows some data structures used in the ARXF-CP


The event queue for a task is a linked list with pointers to allocated events. Each reactive class has a member type RXF_Reactive, which contains a member myTask of type RXF_Active. All RXF_Active elements have a pointer swc which points at the RXF_SWC structure. You are always able to locate the RXF_SWC structure for your Rhapsody SW-C.

On the Configuration tab of the RXF Configuration you can enable a member highwater in the global RXF_SWC structure. You can add this global structure member highwater to your debugger's watch window to analyze the high water marks. Apart from counters the field also contains an overflow flag blockOverflow, which helps to understand if the error handler is called with the error code RXF_ERROR_MEMORY_CONFIG_ERROR to understand which block count, compared to the configured pool sizes is causing this error.

The configuration of high water marks yes/no is not yet at the SW-C level.