Main Page
Reference Manual
Namespace List
Compound List
Namespace Members
Compound Members
File Members
Unless
--disable-alloc was specified during configuration then the following memory allocation and de-allocation debugging features are provided by libcwd:
- Checking if a pointer that is passed to a memory de-allocation function is valid; and if this pointer was previously returned by a corresponding allocation function.
- Finding the start, size, place of allocation in the source code and allocator type of an allocated memory block when given a pointer which points inside of it (see Finding (Information About) Memory Allocations).
- Providing means to add type info and a description to the Allocated memory Overview (using
AllocTag()
). - Listing an overview of allocated memory to a Debug Object.
- Boundary checks of allocated blocks, by means of magic numbers (see also --enable-magic (CWDEBUG_MAGIC)).
Unfortunately it is impossible to support feature 3. in C++ without putting hooks in your code:
- After every memory allocation, the returned pointer should be passed to
AllocTag()
, passing information that needs to be included in the Allocated memory Overview (this is not needed, though allowed, after a call to realloc()
).
A missing AllocTag()
will only have effect on the Allocated memory Overview, showing <unknown type>
instead of the type and a description of the allocated object.
Copyright © 2001 - 2004 Carlo Wood. All rights reserved.