The Memory component API.
More...
#include "Apg.h"
#include "Private.h"
Go to the source code of this file.
The Memory component API.
The Memory component is a simple, doubly-linked list of "cells". A cell is simply a data struct of linked list pointers and memory allocation information.
Definition in file Memory.c.
◆ uiMemCheckPoint()
apg_uint uiMemCheckPoint |
( |
void * |
vpCtx | ) |
|
◆ uiMemStats()
Returns a copy of the Memory componenet's current statistics.
- Parameters
-
vpCtx | a Memory context handle previously returned from vpMemCtor(), or vpMemCtorA(). |
spStats | pointer to a user-supplied statistics buffer. May be NULL, in which case only the required size of the statistics buffer is returned. |
- See also
- vpMemCtor()
-
vpMemCtorA()
-
APG_MEM_STATS
- Returns
- the required size of the statistics buffer.
Definition at line 287 of file Memory.c.
◆ uiMemValidate()
Validates a Memory context handle.
- Parameters
-
- See also
- vpMemCtor()
-
vpMemCtorA()
- Returns
- true if the handle is valid, false otherwise.
Definition at line 115 of file Memory.c.
◆ vMemClear()
void vMemClear |
( |
void * |
vpCtx | ) |
|
◆ vMemDtor()
void vMemDtor |
( |
void * |
vpCtx | ) |
|
◆ vMemFree()
void vMemFree |
( |
void * |
vpCtx, |
|
|
void * |
vpData |
|
) |
| |
◆ vMemFreeToCheckPoint()
void vMemFreeToCheckPoint |
( |
void * |
vpCtx, |
|
|
apg_uint |
uiChk |
|
) |
| |
◆ vpMemAlloc()
void* vpMemAlloc |
( |
void * |
vpCtx, |
|
|
apg_uint |
uiBytes |
|
) |
| |
◆ vpMemCtor()
Constructs a Memory component using malloc() as the memory allocator and free() as the de-allocator.
- Returns
- a Memory context handle (void pointer to an opaque data struct). NULL on failure.
Definition at line 77 of file Memory.c.
◆ vpMemCtorA()
Constructs a Memory component using a user-defined memory allocator and de-allocator.
- Parameters
-
pfnAllocator | pointer to a user-defined memory allocator |
pfnDeAllocator | pointer to a user-defined memory de-allocator |
- Returns
- a Memory context handle (void pointer to an opaque data struct). NULL on failure.
Definition at line 56 of file Memory.c.
◆ vpMemRealloc()
void* vpMemRealloc |
( |
void * |
vpCtx, |
|
|
void * |
vpData, |
|
|
apg_uint |
uiBytes |
|
) |
| |
Re-allocates memory previously allocated with vpMemAlloc(). Can be used to up-size or down-size a memory allocation. Any previous data in the memory allocation is copied to the re-allocation.
- Parameters
-
vpCtx | a Memory context handle previously returned from vpMemCtor(), or vpMemCtorA(). |
vpData | pointer to the memory to be re-allocated. |
uiBytes | number of re-allocated bytes of memory. |
- See also
- vpMemCtor()
-
vpMemCtorA()
-
vpMemAlloc()()
- Returns
- pointer to the re-allocated memory. NULL if re-allocation failed.
Definition at line 182 of file Memory.c.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see
http://www.gnu.org/licenses/licenses.html
or write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.