Function

Camelmempool_new

since: 2.32

Declaration [src]

CamelMemPool*
camel_mempool_new (
  gint blocksize,
  gint threshold,
  CamelMemPoolFlags flags
)

Description [src]

Create a new mempool header. Mempools can be used to efficiently allocate data which can then be freed as a whole.

Mempools can also be used to efficiently allocate arbitrarily aligned data (such as strings) without incurring the space overhead of aligning each allocation (which is not required for strings).

However, each allocation cannot be freed individually, only all or nothing.

Available since: 2.32

This function is not directly available to language bindings.

Parameters

blocksize

Type: gint

The base blocksize to use for all system alocations.

threshold

Type: gint

If the allocation exceeds the threshold, then it is allocated separately and stored in a separate list.

flags

Type: CamelMemPoolFlags

Alignment options: CAMEL_MEMPOOL_ALIGN_STRUCT uses native struct alignment, CAMEL_MEMPOOL_ALIGN_WORD aligns to 16 bits (2 bytes), and CAMEL_MEMPOOL_ALIGN_BYTE aligns to the nearest byte. The default is to align to native structures.

Return value

Type: CamelMemPool

A newly allocated CamelMemPool.

The caller of the function takes ownership of the data, and is responsible for freeing it.