Datasheet

The C and C++ Libraries
ARM DUI 0067D Copyright © 1999-2001 ARM Limited. All rights reserved. 4-65
4.8.10 __Heap_Stats()
Called from
__heapstats()
to print statistics about the state of the heap.
Syntax
void *__Heap_Stats(__Heap_Descriptor *h, int(*print)(void*, char const
*format,...), void *printparam)
Implementation
It must output its results, using the supplied printf-type
print
routine,by calls of the
form:
print(printparam, "%d free blocks\n", nblocks);
The format of the statistics data is implementation-defined, so it can do nothing. This
routine is effectively optional, because it is never called unless the user program calls
__heapstats()
.
4.8.11 __Heap_Valid()
Called from
__heapvalid()
to perform a consistency check on the heap data structures
and attempt to identify an invalid or corrupted heap.
Syntax
int __Heap_Valid(struct __Heap_Descriptor *h, int(*print)(void*, char const
*format,...), void *printparam, int verbose)
Implementation
It must output error messages and diagnostics using the suppliedprintf-type
print
routine. For example, by a call of the form:
print(printparam, "free block at %p is corrupt\n",block_addr);
This routine is effectively optional, because it is never called unless the user program
calls
__heapvalid()
.
Returns
The function must return nonzero if the heap is valid or zero if the heap is corrupted. It
must use
print
to output error messages if it finds problems in the heap. If the
verbose
parameter is nonzero, it can also output diagnostic data.