MemoryManager (FB)ΒΆ

FUNCTION_BLOCK PUBLIC MemoryManager

The MemoryManager maintains a mbm message exchange. If the last message was taken from the exchange, it automatically extends the exchange by the actual size. This can be disabled by setting AutoExtend = FALSE.

How to use:

  1. Call Create() with the block size and the number of blocks you would like to pre-allocate.

  2. Call Malloc() whenever you need memory. As long as MessagesLeft > 0 OR AutoExtend = FALSE, no SysMemAlloc will be performed!

  3. Call Free() to free memory allocated at the MemoryManager.

  4. Call Delete() before shutting down the system.

Properties:

Methods:

Structure: