Setting the Pool Size

You set the initial size of the memory pool on the Memory tab of RTX Properties. If RTSS applications use up all of the memory that you initially allocate, the local pool must request more memory from Windows. The amount of memory provided by Windows is equal to the initialization size or the requested memory size, whichever is larger. Requesting memory from Windows involves activity which is non-deterministic.

NOTE:  You cannot request additional memory from Windows from within a shutdown handler.

To avoid this scenario, it is important to be aware of your applications' memory needs and specify an initial pool size that will support them. The RTX function RtQueryLocalMemory can be used to check to make sure there is enough free memory left in the local memory pool. This is a useful call for working within a shutdown handler.

If local memory pool usage is enabled from the RTX Properties control panel or the RtssRun utility, all the memory allocations explicitly or implicitly in the RTSS application are allocated from local memory pool. As a result, the following functions become deterministic and can be called in the shutdown handler.

NOTE:  When allocating a small chunk of memory, we recommend you use the function RtAllocateLocalMemory instead of malloc.

RtAllocateLockedMemory

HeapFree

RtCreateMutex

RtFreeLockedMemory

HeapReAlloc

RtOpenMutex

RtCreateSharedMemory

malloc

RtCreateSemaphore

RtOpenSharedMemory

calloc

RtOpenSemaphore

RtOpenSharedMemory

realloc

RtCloseHandle

HeapAlloc

free

InitializeCriticalSection

HeapCreate

RtCreateEvent

DeleteCriticalSection

HeapDestroy

RtOpenEvent

CreateThread*

*CreateThread - The stack has no guard page for the thread created in the local memory pool.

 

See Also

IntervalZero.com | Support | Give Feedback