Appendix D Diagnostic messages
The following table lists the warnings and errors that are likely to appear in
the mpatrol log file when problems with dynamic memory allocations and memory
operations occur. Other types of warnings and errors may also appear in the log
file, but they are likely to be associated with parsing options and reading
symbols from executable files and so should be self-explanatory.
In all cases, if a warning or error is caused by one of the memory access
checking functions (invoked through the use of the -fcheck-memory-usage
option to the GNU compiler) then execution will halt regardless, despite what
the description of the diagnostic message says.
If a warning or error occurs due to a direct call to an mpatrol library function
then an attempt will be made to provide a log entry for the call. If the
diagnostic was not caused by a normal memory allocation, reallocation or
deallocation function then the log entry will be preceded by `LOG:'. The
function type will be listed as `check' if it does not fall into the normal
categories or if not enough information is available.
Note that on UNIX platforms, if the diagnostic message is caused by a line in
the program source then the EDIT and LIST options can be used
to illustrate more clearly where in the source code the warning or error
occurred.
- `ALLOVF'
- Message
- `allocation %1 has a corrupted overflow buffer at %2'
- Type
- Error
- `%1'
- The pointer to the memory allocation that has a corrupted overflow buffer.
- `%2'
- The pointer to the first byte of corruption in the memory allocation's overflow
buffer.
- Cause
- Something has corrupted the overflow buffer of a memory allocation and this has
been caught at the next invocation of an mpatrol function when the
OFLOWSIZE or PAGEALLOC options were used. This particular
error message will not occur if the OFLOWWATCH option was used since
all overflow buffers will be write protected.
- Additional
- The log file entry, the library summary, the contents of the overflow buffer and
information about the original memory allocation.
- Result
- Execution terminates.
- `ALLZER'
- Message
- `attempt to create an allocation of size 0'
- Type
- Warning
- Cause
- A function was called to allocate memory with a size of `0' when either of
the CHECKALL or CHECKALLOCS options were used. This warning
will not occur by default as the ANSI C/C++ standards allow this behaviour, and
it is really only a portability issue.
- Additional
- The log file entry.
- Result
- The size is increased to 1 byte and execution continues.
- `BADALN'
- Message
- `alignment %1 is not a power of two'
- Type
- Warning
- `%1'
- The alignment in bytes.
- Cause
- The
memalign()
function was called to allocate memory with an alignment
which was not a power of two when either of the CHECKALL or
CHECKALLOCS options were used.
- Additional
- The log file entry.
- Result
- The alignment is rounded up to the nearest power of two and execution continues.
- `FRDCOR'
- Message
- `freed allocation %1 has memory corruption at %2'
- Type
- Error
- `%1'
- The pointer to the freed memory allocation that has been corrupted.
- `%2'
- The pointer to the first byte of corruption in the freed memory allocation.
- Cause
- Something has corrupted the contents of a previously freed memory allocation and
this has been caught at the next invocation of an mpatrol function when the
NOFREE option was used. This particular error message will not occur
if the PAGEALLOC option was used since all freed memory allocations
will be write protected and will also not occur if the PRESERVE option
was used since the free byte cannot be used to verify the freed allocation's
contents.
- Additional
- The log file entry, the library summary, the contents of the freed memory block
and information about the original memory allocation.
- Result
- Execution terminates.
- `FRDOPN'
- Message
- `attempt to perform operation on freed memory'
- Type
- Error
- Cause
- A memory operation function was called to operate on a previously freed memory
allocation when the NOFREE option was used.
- Additional
- The log file entry and information about the original memory allocation.
- Result
- The memory operation fails and execution continues.
- `FRDOVF'
- Message
- `freed allocation %1 has a corrupted overflow buffer at %2'
- Type
- Error
- `%1'
- The pointer to the freed memory allocation that has a corrupted overflow buffer.
- `%2'
- The pointer to the first byte of corruption in the freed memory allocation's
overflow buffer.
- Cause
- Something has corrupted the overflow buffer of a previously freed memory
allocation and this has been caught at the next invocation of an mpatrol
function when the NOFREE option was used in conjunction with the
OFLOWSIZE or PAGEALLOC options. This particular error message
will not occur if the OFLOWWATCH option was used since all overflow
buffers will be write protected.
- Additional
- The log file entry, the library summary, the contents of the overflow buffer and
information about the original memory allocation.
- Result
- Execution terminates.
- `FRECOR'
- Message
- `free memory corruption at %1'
- Type
- Error
- `%1'
- The pointer to the first byte of corruption in free memory.
- Cause
- Something has corrupted the contents of the free memory pool and this has been
caught at the next invocation of an mpatrol function. This particular error
message will not occur if the PAGEALLOC option was used since all free
memory will be write protected.
- Additional
- The log file entry, the library summary and the contents of the free memory
block.
- Result
- Execution terminates.
- `FREMRK'
- Message
- `attempt to free marked allocation %1'
- Type
- Error
- `%1'
- The pointer to the memory allocation that has been requested to be freed.
- Cause
- An attempt was made to free a marked memory allocation. This is not allowed
since any memory allocations that have been marked indicate to the mpatrol
library that they should remain allocated for the duration of the program.
- Additional
- The log file entry and information about the original memory allocation.
- Result
- No memory allocation will be freed and execution continues.
- `FRENUL'
- Message
- `attempt to free a NULL pointer'
- Type
- Warning
- Cause
- A function was called to free an existing memory allocation with a pointer of
`NULL' when either of the CHECKALL or CHECKFREES options
were used. This warning will not occur by default as the ANSI C/C++ standards
allow this behaviour, and it is really only a portability issue.
- Additional
- The log file entry.
- Result
- No memory allocation will be freed and execution continues.
- `FREOPN'
- Message
- `attempt to perform operation on free memory'
- Type
- Error
- Cause
- A memory operation function was called to operate on free memory.
- Additional
- The log file entry.
- Result
- The memory operation fails and execution continues.
- `ILLMEM'
- Message
- `illegal memory access at address %1'
- Type
- Error
- `%1'
- The address at which the illegal memory access occurred.
- Cause
- An attempt was made to read from or write to an illegal address on systems which
have virtual memory. This address may or may not exist in the heap, or it may
be a perfectly valid address that was misaligned and caused a bus error. In
either case, the mpatrol library will attempt to associate the address with an
existing memory allocation. This error may also appear instead of memory
corruption errors if the PAGEALLOC or OFLOWWATCH options were
used.
- Additional
- The library summary, information about the original memory allocation (if
possible) and the call stack of where the error occurred.
- Result
- Execution terminates.
- `INCOMP'
- Message
- `%1 was allocated with %2'
- Type
- Error
- `%1'
- The pointer to the memory allocation that is to be resized or freed.
- `%2'
- The name of the function which originally allocated the memory allocation.
- Cause
- A function was called to resize or free a memory allocation that was allocated
with a function that is incompatible with the current request. For example,
a memory allocation which was allocated with
operator new
being resized
with realloc()
.
- Additional
- The log file entry and information about the original memory allocation.
- Result
- The reallocation or deallocation fails and execution continues.
- `MAXALN'
- Message
- `alignment %1 is greater than the system page size'
- Type
- Warning
- `%1'
- The alignment in bytes.
- Cause
- The
memalign()
function was called to allocate memory with an alignment
which was greater than the system page size when either of the CHECKALL
or CHECKALLOCS options were used. The mpatrol library cannot currently
align memory allocations to a byte alignment over this limit, but then neither
can most other implementations.
- Additional
- The log file entry.
- Result
- The alignment is set to the system page size and execution continues.
- `MISMAT'
- Message
- `%1 does not match allocation of %2'
- Type
- Error
- `%1'
- The pointer to the memory allocation that is to be resized or freed.
- `%2'
- The pointer to the memory allocation that the mpatrol library knows about.
- Cause
- A function was called to resize or free a memory allocation that begins at a
different address from that supplied.
- Additional
- The log file entry and information about the original memory allocation.
- Result
- The reallocation or deallocation fails and execution continues.
- `NOTALL'
- Message
- `%1 has not been allocated'
- Type
- Error
- `%1'
- The pointer to the memory allocation that is to be resized or freed.
- Cause
- A function was called to resize or free a memory allocation that has not been
allocated. It may be that the memory allocation has just been freed, in which
case the NOFREE option should be used to provide a better diagnostic
message.
- Additional
- The log file entry.
- Result
- The reallocation or deallocation fails and execution continues.
- `NULOPN'
- Message
- `attempt to perform operation on a NULL pointer'
- Type
- Error
- Cause
- A memory operation function was called to operate on a `NULL' pointer. If
the length of the operation was zero then this error will only occur when the
CHECKALL or CHECKMEMORY options were used as the ANSI C/C++
standards allow this behaviour, and it is really only a portability issue.
- Additional
- The log file entry.
- Result
- The memory operation fails and execution continues.
- `OUTMEM'
- Message
- `out of memory'
- Type
- Error
- Cause
- The
alloca()
, xmalloc()
or MP_MALLOC()
families of
functions were called to allocate memory, but no more memory was available to
allocate and the low-memory handler, if installed, could not free up sufficient
memory. This error can also be caused by a call to the operator new
or
operator new[]
C++ operators (not the nothrow versions) when they
would otherwise return a `NULL' pointer and the mpatrol library was
compiled with a C compiler (which means that it cannot throw a
std::bad_alloc
exception).
- Additional
- The library summary.
- Result
- Execution terminates.
- `PRVFRD'
- Message
- `%1 was freed with %2'
- Type
- Error
- `%1'
- The pointer to the memory allocation that is to be resized or freed.
- `%2'
- The name of the function which originally freed the memory allocation.
- Cause
- A function was called to resize or free a memory allocation that had previously
been freed when the NOFREE option was used.
- Additional
- The log file entry and information about the original memory allocation.
- Result
- The reallocation or deallocation fails and execution continues.
- `RNGOVF'
- Message
- `range [%1,%2] overflows [%3,%4]'
- Type
- Warning/Error
- `%1'
- The start address of the memory region.
- `%2'
- The end address of the memory region.
- `%3'
- The start address of the memory allocation.
- `%4'
- The end address of the memory allocation.
- Cause
- A memory operation function was called to operate on a range of memory which
overflowed the boundaries of a memory allocation.
- Additional
- The log file entry and information about the original memory allocation.
- Result
- The operation will be only be performed (and will be changed from an error to a
warning) if the ALLOWOFLOW option was used, but execution will continue
regardless.
- `RNGOVL'
- Message
- `range [%1,%2] overlaps [%3,%4]'
- Type
- Warning
- `%1'
- The start address of the source memory region.
- `%2'
- The end address of the source memory region.
- `%3'
- The start address of the destination memory region.
- `%4'
- The end address of the destination memory region.
- Cause
- The
memcpy()
or memccpy()
function was called to copy overlapping
memory regions. This is an error on many systems and the ANSI C/C++ standards
specify that memmove()
should be used instead.
- Additional
- The log file entry.
- Result
- The copy operation will still be performed but it will deal correctly with
overlapping memory regions.
- `RSZNUL'
- Message
- `attempt to resize a NULL pointer'
- Type
- Warning
- Cause
- A function was called to resize an existing memory allocation with a pointer of
`NULL' when either of the CHECKALL or CHECKREALLOCS
options were used. This warning will not occur by default as the ANSI C/C++
standards allow this behaviour, and it is really only a portability issue.
- Additional
- The log file entry.
- Result
- A new memory allocation is returned and execution continues.
- `RSZZER'
- Message
- `attempt to resize an allocation to size 0'
- Type
- Warning
- Cause
- A function was called to resize an existing memory allocation to a size of
`0' when either of the CHECKALL or CHECKREALLOCS options
were used. This warning will not occur by default as the ANSI C/C++ standards
allow this behaviour, and it is really only a portability issue.
- Additional
- The log file entry.
- Result
- The existing memory allocation will be freed and execution continues.
- `STROVF'
- Message
- `string %1 overflows [%2,%3]'
- Type
- Error
- `%1'
- The start address of the string.
- `%2'
- The start address of the memory allocation.
- `%3'
- The end address of the memory allocation.
- Cause
- A string function was called to operate on a string which overflowed the
boundaries of a memory allocation.
- Additional
- The log file entry and information about the original memory allocation.
- Result
- The operation will not be performed and execution continues.
- `ZERALN'
- Message
- `alignment 0 is invalid'
- Type
- Warning
- Cause
- The
memalign()
function was called to allocate memory with an alignment
of `0' when either of the CHECKALL or CHECKALLOCS options
were used.
- Additional
- The log file entry.
- Result
- The alignment is set to the default system alignment and execution continues.
- `ZEROPN'
- Message
- `attempt to perform a zero-sized operation'
- Type
- Warning
- Cause
- A memory operation function was called with a length of zero. This warning
will only occur when the CHECKALL or CHECKMEMORY options were
used as the ANSI C/C++ standards allow this behaviour, and it is really only a
portability issue.
- Additional
- The log file entry.
- Result
- The operation will not be performed and execution continues.