Vector 0.0.2
Loading...
Searching...
No Matches
Allocation

Allocator functions. More...

Collaboration diagram for Allocation:

Functions

void * vector_alloc (const size_t alloc_size, void *const param)
 Allocates memory chunk of alloc_size.
 
void * vector_realloc (void *ptr, const size_t alloc_size, void *const param)
 Reallocates already allocated memory chunk in order to change allocation size.
 
void vector_free (void *ptr, void *const param)
 Free allocation that was previously allocated.
 

Detailed Description

Allocator functions.

These are weak symbols that can be overridden by the user. You can customize how you allocate underling memory for the vector. By passing param you can go even further and customize allocation process per vector instance.

Function Documentation

◆ vector_alloc()

void * vector_alloc ( const size_t alloc_size,
void *const param )

Allocates memory chunk of alloc_size.

Parameters
[in]alloc_sizeAllocation size in bytes
[in,out]paramOptional allocator parameter.
See also
alloc_opts_t
Returns
allocated memory chunk or NULL pointer on failure.

Definition at line 44 of file aligned_alloc.c.

◆ vector_realloc()

void * vector_realloc ( void * ptr,
const size_t alloc_size,
void *const param )

Reallocates already allocated memory chunk in order to change allocation size.

Warning
This operation can move whole chunk to a completely different location.
Parameters
[in]ptrPointer to a memory chunk previously allocated with current allocator!
[in]alloc_sizeAllocation size in bytes
[in,out]paramOptional allocator parameter.
See also
alloc_opts_t
Returns
allocated memory chunk or NULL pointer on failure.

Definition at line 51 of file aligned_alloc.c.

◆ vector_free()

void vector_free ( void * ptr,
void *const param )

Free allocation that was previously allocated.

Parameters
[in]ptrPointer to a memory chunk previously allocated with current allocator!
[in,out]paramOptional allocator parameter.
See also
alloc_opts_t

Definition at line 74 of file aligned_alloc.c.