23#ifdef DEBUG_MEMORY_LOCATION
48#if !defined(LIBXML_THREAD_ENABLED) && !defined(LIBXML_THREAD_ALLOC_ENABLED)
69#define MALLOC_ATOMIC_TYPE 4
70#define REALLOC_ATOMIC_TYPE 5
89#define ALIGN_SIZE sizeof(double)
91#define HDR_SIZE sizeof(MEMHDR)
92#define RESERVE_SIZE (((HDR_SIZE + (ALIGN_SIZE-1)) \
93 / ALIGN_SIZE ) * ALIGN_SIZE)
95#define MAX_SIZE_T ((size_t)-1)
97#define CLIENT_2_HDR(a) ((void *) (((char *) (a)) - RESERVE_SIZE))
98#define HDR_2_CLIENT(a) ((void *) (((char *) (a)) + RESERVE_SIZE))
110static void debugmem_list_add(
MEMHDR *);
111static void debugmem_list_delete(
MEMHDR *);
113#define Mem_Tag_Err(a) debugmem_tag_error(a);
153 "Malloc(%d)\n",
size);
160 "xmlMallocLoc : Unsigned overflow\n");
169 "xmlMallocLoc : Out of free space\n");
184 debugmem_list_add(
p);
190 "Malloc(%d) Ok\n",
size);
200 (
long unsigned)
size);
229 "Malloc(%d)\n",
size);
236 "xmlMallocAtomicLoc : Unsigned overflow\n");
245 "xmlMallocAtomicLoc : Out of free space\n");
260 debugmem_list_add(
p);
266 "Malloc(%d) Ok\n",
size);
276 (
long unsigned)
size);
338 oldsize =
p->mh_size;
341 debugmem_list_delete(
p);
347 "xmlReallocLoc : Unsigned overflow\n");
360 "%p : Realloced(%lu -> %lu) Ok\n",
362 (
long unsigned)
size);
376 debugmem_list_add(
p);
384 "Realloced(%d to %d) Ok\n", oldsize,
size);
425 if (
ptr == (
void *) -1) {
427 "trying to free pointer from freed area\n");
456 debugmem_list_delete(
p);
466 "Freed(%d) Ok\n",
size);
473 "xmlMemFree(%p) error\n",
ptr);
501 "xmlMemStrdupLoc : Unsigned overflow\n");
521 debugmem_list_add(
p);
618 if (
buf[
i] == 0)
break;
621 if ((
i < 4) && ((
buf[
i] != 0) || (
i == 0))) {
626 for (
j = 0;(
j <
len -3) && (
j < 40);
j += 4) {
634 if (
k++ > 100)
break;
637 fprintf(fp,
" pointer to #%lu at index %d",
643 }
else if ((
i == 0) && (
buf[
i] == 0)) {
649 for (
j = 0;
j <
i;
j++)
681 fp =
fopen(
".memorylist",
"w");
687 fprintf(fp,
" Last %li MEMORY ALLOCATED : %lu, MAX was %lu\n",
689 fprintf(fp,
"BLOCK NUMBER SIZE TYPE\n");
693 while ((
p) && (nbBytes > 0)) {
695 (
unsigned long)
p->mh_size);
696 switch (
p->mh_type) {
703 fprintf(fp,
"Unknown memory block, may be corrupted");
709 if (
p->mh_file !=
NULL)
fprintf(fp,
"%s(%u)",
p->mh_file,
p->mh_line);
714 xmlMemContentShow(fp,
p);
719 nbBytes -= (
unsigned long)
p->mh_size;
724 fprintf(fp,
"Memory list not compiled (MEM_LIST not defined !)\n");
752 fp =
fopen(
".memorylist",
"w");
764 fprintf(fp,
" MEMORY ALLOCATED : %lu, MAX was %lu\n",
766 fprintf(fp,
"BLOCK NUMBER SIZE TYPE\n");
772 (
unsigned long)
p->mh_size);
773 switch (
p->mh_type) {
780 fprintf(fp,
"Unknown memory block, may be corrupted");
786 if (
p->mh_file !=
NULL)
fprintf(fp,
"%s(%u)",
p->mh_file,
p->mh_line);
791 xmlMemContentShow(fp,
p);
800 fprintf(fp,
"Memory list not compiled (MEM_LIST not defined !)\n");
808static void debugmem_list_add(
MEMHDR *
p)
810 p->mh_next = memlist;
812 if (memlist) memlist->mh_prev =
p;
820static void debugmem_list_delete(
MEMHDR *
p)
823 p->mh_next->mh_prev =
p->mh_prev;
825 p->mh_prev->mh_next =
p->mh_next;
826 else memlist =
p->mh_next;
844 "Memory tag error occurs :%p \n\t bye\n",
p);
852static FILE *xmlMemoryDumpFile =
NULL;
872 fprintf(fp,
" MEMORY ALLOCATED : %lu, MAX was %lu\n",
877 fprintf(fp,
"NUMBER SIZE TYPE WHERE\n");
879 while ((
p) &&
nr > 0) {
880 fprintf(fp,
"%6lu %6lu ",
p->mh_number,(
unsigned long)
p->mh_size);
881 switch (
p->mh_type) {
887 default:
fprintf(fp,
" ??? in ");
break;
889 if (
p->mh_file !=
NULL)
890 fprintf(fp,
"%s(%u)",
p->mh_file,
p->mh_line);
893 xmlMemContentShow(fp,
p);
919 xmlMemoryDumpFile =
stderr;
920 else xmlMemoryDumpFile =
dump;
951 "xmlInitMemory()\n");
972 "xmlInitMemory() Ok\n");
992 "xmlCleanupMemory()\n");
1002 "xmlCleanupMemory() Ok\n");
1028 if (freeFunc ==
NULL)
1030 if (mallocFunc ==
NULL)
1032 if (reallocFunc ==
NULL)
1034 if (strdupFunc ==
NULL)
1043 "xmlMemSetup() Ok\n");
1093 "xmlGcMemSetup()\n");
1095 if (freeFunc ==
NULL)
1097 if (mallocFunc ==
NULL)
1099 if (mallocAtomicFunc ==
NULL)
1101 if (reallocFunc ==
NULL)
1103 if (strdupFunc ==
NULL)
1112 "xmlGcMemSetup() Ok\n");
ACPI_SIZE strlen(const char *String)
char * strcpy(char *DstString, const char *SrcString)
GLdouble GLdouble GLdouble GLdouble q
GLenum GLuint GLenum GLsizei const GLchar * buf
GLenum const GLvoid * addr
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
_Check_return_ _CRTIMP FILE *__cdecl fopen(_In_z_ const char *_Filename, _In_z_ const char *_Mode)
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
_Check_return_ _CRTIMP int __cdecl sscanf(_In_z_ const char *_Src, _In_z_ _Scanf_format_string_ const char *_Format,...)
_Check_return_ char *__cdecl getenv(_In_z_ const char *_VarName)
static unsigned int number
static void dump(const void *ptr, unsigned len)
_CRTIMP struct tm *__cdecl localtime(const time_t *_Time)
XMLPUBVAR xmlMallocFunc xmlMallocAtomic
XMLPUBVAR xmlStrdupFunc xmlMemStrdup
XMLPUBVAR xmlMallocFunc xmlMalloc
XMLPUBVAR xmlFreeFunc xmlFree
XMLPUBVAR void * xmlGenericErrorContext
XMLPUBVAR xmlReallocFunc xmlRealloc
XMLPUBVAR xmlGenericErrorFunc xmlGenericError
size_t CDECL strftime(char *str, size_t max, const char *format, const struct tm *mstm)
XMLPUBFUN void XMLCALL xmlMutexUnlock(xmlMutexPtr tok)
XMLPUBFUN xmlMutexPtr XMLCALL xmlNewMutex(void)
XMLPUBFUN void XMLCALL xmlFreeMutex(xmlMutexPtr tok)
XMLPUBFUN void XMLCALL xmlMutexLock(xmlMutexPtr tok)
void * xmlMallocAtomicLoc(size_t size, const char *file, int line)
static int xmlMemInitialized
void xmlMallocBreakpoint(void)
void xmlMemFree(void *ptr)
void * xmlMemMalloc(size_t size)
#define MALLOC_ATOMIC_TYPE
void * xmlMemRealloc(void *ptr, size_t size)
static unsigned int block
int xmlGcMemSetup(xmlFreeFunc freeFunc, xmlMallocFunc mallocFunc, xmlMallocFunc mallocAtomicFunc, xmlReallocFunc reallocFunc, xmlStrdupFunc strdupFunc)
#define REALLOC_ATOMIC_TYPE
void xmlMemDisplayLast(FILE *fp, long nbBytes)
void xmlCleanupMemory(void)
void * xmlMallocLoc(size_t size, const char *file, int line)
static unsigned long debugMemBlocks
static unsigned int xmlMemStopAtBlock
static void debugmem_tag_error(void *addr)
char * xmlMemoryStrdup(const char *str)
static xmlMutexPtr xmlMemMutex
char * xmlMemStrdupLoc(const char *str, const char *file, int line)
int xmlMemSetup(xmlFreeFunc freeFunc, xmlMallocFunc mallocFunc, xmlReallocFunc reallocFunc, xmlStrdupFunc strdupFunc)
int xmlGcMemGet(xmlFreeFunc *freeFunc, xmlMallocFunc *mallocFunc, xmlMallocFunc *mallocAtomicFunc, xmlReallocFunc *reallocFunc, xmlStrdupFunc *strdupFunc)
int xmlMemGet(xmlFreeFunc *freeFunc, xmlMallocFunc *mallocFunc, xmlReallocFunc *reallocFunc, xmlStrdupFunc *strdupFunc)
static unsigned long debugMemSize
static void * xmlMemTraceBlockAt
void xmlMemShow(FILE *fp, int nr ATTRIBUTE_UNUSED)
void * xmlReallocLoc(void *ptr, size_t size, const char *file, int line)
static unsigned long debugMaxMemSize
void xmlMemDisplay(FILE *fp)
void *(XMLCALL * xmlReallocFunc)(void *mem, size_t size)
char *(XMLCALL * xmlStrdupFunc)(const char *str)
void(XMLCALL * xmlFreeFunc)(void *mem)