CreateMemPool

Creates memory pools.

Synopsis

MemPoolPtr CreateMemPool (long numToPreallocate, long sizeOfEntry)

Description

Creates memory pools used by the DataStreamer. An acquisition thread calls CreateMemPool() to create the memory pool in which data chunks are stored. The DataStreamer kernel thread calls CreateMemPool() to create the memory pool allocated to subscriber and data messages that are used to pass the data chunks out to various subscribers.

Each memory pool is a MemPool data structure containing pool entry-table information and memory buffer entries. CreateMemPool() creates a new memory pool with the specified number and size of entries.

CreateMemPool() creates each memory pool by calling malloc() directly. Memory pools must be sized in multiples of four bytes (a full data word).

Arguments

numToPreallocate
Number of entries in the memory pool.
sizeOfEntry
Size of each entry, in bytes. Values will be rounded up to the nearest 4-byte multiple.

Return Value

Value
Error Condition
(Pointer to the memory pool)
None
NULL
Could not allocate memory for pool

Associated Files

MemPool.h

See Also

DeleteMemPool, InitDataAcq, InitDataStreaming