|
NAMElibmpalloc - dynamic memory allocation replacement librarySYNOPSIS#include <mpalloc.h> void *MP_MALLOC(void *ptr, size_t count, typename type); void *MP_CALLOC(void *ptr, size_t count, typename type); char *MP_STRDUP(char *ptr, const char *str); void *MP_REALLOC(void *ptr, size_t count, typename type); void MP_FREE(void *ptr); __mp_failhandler MP_FAILURE(__mp_failhandler func); DESCRIPTIONThe mpalloc library contains release implementations of all of the mpatrol library functions, with all of its checking, debugging and tracing features disabled. It is fully link-compatible with the mpatrol library and so can be linked in instead of the mpatrol library in order to quickly disable all of its features without requiring a complete recompilation of all of the source files in a project. It also contains implementations of the MP_MALLOC family of functions that can be used in a release environment.All of the function definitions in mpatrol.h can be disabled by defining the NDEBUG preprocessor macro, which is the same macro used to control the behaviour of the assert function. If NDEBUG is defined then no macro redefinition of functions will take place and all special mpatrol library functions will evaluate to empty statements. The mpalloc.h header file will also be included in this case. It is intended that the NDEBUG preprocessor macro be defined in release builds. The mpalloc library contains functional replacements for all of the mpatrol library's dynamic memory allocation and memory operation functions, mainly for use in situations where not all of the source files in a project have been recompiled with the NDEBUG preprocessor macro in order to remove mpatrol. However, not all of these functions can be fully implemented using ANSI C and so may contain some limitations. The only recommended solution for a final release is to perform a complete recompile with NDEBUG defined. FUNCTIONSThe following 6 functions are provided as convenient alternatives to the ANSI C dynamic memory allocation functions (although strdup is not strictly an ANSI C function). They are implemented as preprocessor macro functions which may evaluate their arguments more than once, so extra care should be taken to avoid passing arguments with side-effects. None of the functions return NULL if no memory is available and instead abort the program with a useful error message indicating where the call to allocate memory came from and what was being allocated. To use these you should include the mpalloc.h header file:
SEE ALSOmpatrol(1), mprof(1), mptrace(1), mleak(1), mpsym(1), mpedit(1), hexwords(1), libmpatrol(3), malloc(3), assert(3).The mpatrol manual and reference card. http://www.cbmamiga.demon.co.uk/mpatrol/ AUTHORGraeme S. Roy <graeme.roy@analog.com>COPYRIGHTCopyright (C) 1997-2002 Graeme S. Roy <graeme.roy@analog.com>This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
Visit the GSP FreeBSD Man Page Interface. |