Memory pool.
More...
#include <stddef.h>
Go to the source code of this file.
|
typedef struct StPool | StPool |
| pool.
|
|
Memory pool.
Glossary
Term | Description |
pool | fixed-size blocks memory pool |
◆ st_pool_alloc()
void * st_pool_alloc |
( |
StPool * |
pool | ) |
|
Allocate a block from a pool.
- Parameters
-
If the pool is empty, allocates a new block from the system memory allocator.
- See also
- st/os/mem.h
- Returns
- The block.
◆ st_pool_create()
StPool * st_pool_create |
( |
size_t |
blk_size | ) |
|
Create a pool.
- Parameters
-
[in] | blk_size | The size of the blocks. |
- Returns
- A new pool.
◆ st_pool_destroy()
void st_pool_destroy |
( |
StPool * |
pool | ) |
|
Destroy a pool.
- Parameters
-
◆ st_pool_free()
void st_pool_free |
( |
StPool * |
pool, |
|
|
void * |
blk |
|
) |
| |
Return a block to a pool.
- Parameters
-
[in,out] | pool | The pool. |
[in,out] | blk | The block. |
◆ st_pool_tryalloc()
void * st_pool_tryalloc |
( |
StPool * |
pool | ) |
|
Try to allocate a block from a pool.
- Parameters
-
- Returns
- The block, if the pool is not empty. Otherwise, NULL.