Version 7.0
Copyright © 2021 Lowell D. Thomas
APG
… an ABNF Parser Generator
library
memory.h
Go to the documentation of this file.
1
/* *************************************************************************************
2
Copyright (c) 2021, Lowell D. Thomas
3
All rights reserved.
4
5
This file is part of APG Version 7.0.
6
APG Version 7.0 may be used under the terms of the BSD 2-Clause License.
7
8
Redistribution and use in source and binary forms, with or without
9
modification, are permitted provided that the following conditions are met:
10
11
1. Redistributions of source code must retain the above copyright notice, this
12
list of conditions and the following disclaimer.
13
14
2. Redistributions in binary form must reproduce the above copyright notice,
15
this list of conditions and the following disclaimer in the documentation
16
and/or other materials provided with the distribution.
17
18
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
29
* *************************************************************************************/
30
#ifndef LIB_MEMORY_H_
31
#define LIB_MEMORY_H_
32
45
typedef
struct
{
46
aint
uiAllocations
;
47
aint
uiReAllocations
;
48
aint
uiFrees
;
49
aint
uiCells
;
50
aint
uiMaxCells
;
51
aint
uiHeapBytes
;
52
aint
uiMaxHeapBytes
;
53
}
mem_stats
;
54
55
void
*
vpMemCtor
(
exception
* spException);
56
void
vMemDtor
(
void
* vpCtx);
57
abool
bMemValidate
(
void
* vpCtx);
58
void
*
vpMemAlloc
(
void
* vpCtx,
aint
uiBytes);
59
void
vMemFree
(
void
* vpCtx,
const
void
* vpData);
60
void
*
vpMemRealloc
(
void
* vpCtx,
const
void
* vpData,
aint
uiBytes);
61
aint
uiMemCount
(
void
* vpCtx);
62
void
vMemClear
(
void
* vpCtx);
63
void
vMemStats
(
void
* vpCtx,
mem_stats
* spStats);
64
exception
*
spMemException
(
void
* vpCtx);
65
66
#endif
/* LIB_MEMORY_H_ */
mem_stats::uiMaxCells
aint uiMaxCells
Definition:
memory.h:50
mem_stats::uiCells
aint uiCells
Definition:
memory.h:49
mem_stats::uiReAllocations
aint uiReAllocations
Definition:
memory.h:47
vpMemAlloc
void * vpMemAlloc(void *vpCtx, aint uiBytes)
Allocates memory.
Definition:
memory.c:196
mem_stats::uiMaxHeapBytes
aint uiMaxHeapBytes
Definition:
memory.h:52
uiMemCount
aint uiMemCount(void *vpCtx)
Returns the number of memory allocations.
Definition:
memory.c:342
mem_stats
Available to the user for display of memory statistics.
Definition:
memory.h:45
aint
uint_fast32_t aint
The APG parser's unsigned integer type.
Definition:
apg.h:79
vMemDtor
void vMemDtor(void *vpCtx)
Destroys a Memory component. Frees all memory allocated.
Definition:
memory.c:141
mem_stats::uiHeapBytes
aint uiHeapBytes
Definition:
memory.h:51
vpMemCtor
void * vpMemCtor(exception *spException)
Construct a memory component.
Definition:
memory.c:121
exception
A structure to describe the type and location of a caught exception.
Definition:
exception.h:47
spMemException
exception * spMemException(void *vpCtx)
Get a pointer to this memory objects's exception handler.
Definition:
memory.c:174
vMemClear
void vMemClear(void *vpCtx)
Frees all memory allocations.
Definition:
memory.c:361
vMemFree
void vMemFree(void *vpCtx, const void *vpData)
Free memory previously allocated with vpMemAlloc().
Definition:
memory.c:226
vMemStats
void vMemStats(void *vpCtx, mem_stats *spStats)
Returns a copy of the Memory component's current statistics.
Definition:
memory.c:456
mem_stats::uiFrees
aint uiFrees
Definition:
memory.h:48
vpMemRealloc
void * vpMemRealloc(void *vpCtx, const void *vpData, aint uiBytes)
Re-allocates memory previously allocated with vpMemAlloc().
Definition:
memory.c:268
abool
uint8_t abool
abool is the APG bool type.
Definition:
apg.h:140
mem_stats::uiAllocations
aint uiAllocations
Definition:
memory.h:46
bMemValidate
abool bMemValidate(void *vpCtx)
Validates a memory context.
Definition:
memory.c:160
Generated on Sun Jun 13 2021 14:32:59 for APG by
1.8.17
APG Version 7.0 is licensed under the
2-Clause BSD License
,
an Open Source Initiative Approved License.