INtime SDK Help
mpool_create
INtime SDK v7.1 > About INtime > Other system libraries > Heaps and memory pools > Memory pools > mpool_create

Creates a memory pool and returns a handle to it.

MPOOL mpool_create(
    void * base,
    DWORD pool_size,
    DWORD blk_size,
    DWORD flags,
    char  *name 
);

Parameters

base
Valid values include:
NULL (Dynamic pool) Allocates pages as needed from the system memory pool.
non-NULL (Static pool) Points to a buffer of at least one page in size (4K). This buffer should not be on the stack.
These pools are respectively referred to as dynamic and static pools.
pool_size
The upper limit of a pool:
0 (zero) The pool can grow to the limit of process memory.
n The maximum pool size.
Pool size may not be greater than LONG_MAX.
blk_size
The basic allocation unit size when more memory is required. This value is expressed as a multiple of the system page size. 2 (two) is a very efficient value.
flags
Valid values include:
MPOOL_NOLOCK Do not employ a lock for mutual exclusion.
MPOOL_BEST_FIT Use the best fit for allocation.
MPOOL_FIRST_FIT Use the first fit for allocation.
MPOOL_ZAP Fill the buffers with 0 when freeing.
MPOOL_FILL Fill the buffers with pattern "fill_char" when allocating; see MPOOL_CONFIG.
If both MPOOL_BEST_FIT and MPOOL_FIRST_FIT are specified, MPOOL_BEST_FIT takes precedence.
name
(Optional) A string that names the pool. If name is omitted, a default name is created of the form MPOOL-XXXXXXXX where XXXXXXXX represents in hexidecimal the value returned from mpool_create.

Remarks

Static pools may be created in memory defined by the process's data area, its stdlib heap, or memory returned from AllocateRtMemory and MapRtPhysicalMemory.

Return Values

A handle to a memory pool.
Success.
NULL
Failure. The function sets errno to one of these values:
E2BIG The value of pool_size is too large.
EEXIST The pool is deleted.
EINVAL A parameter is invalid.
ENOSPC Out of virtual memory.
ENOMEM Out of physical memory.

Requirements

Versions Defined in Include Link to
INtime 4.0 intime/rt/include/mpool.h mpool.h clib.lib
   
See Also

Memory