version 1.18, 2000/10/23 18:59:50
|
version 1.19, 2000/10/25 19:26:53
|
Line 31
|
Line 31
|
|
|
|
|
#include <libxml/xmlmemory.h> |
#include <libxml/xmlmemory.h> |
|
#include <libxml/xmlerror.h> |
|
|
#ifdef xmlMalloc |
#ifdef xmlMalloc |
#undef xmlMalloc |
#undef xmlMalloc |
Line 111 void debugmem_list_delete(MEMHDR *);
|
Line 112 void debugmem_list_delete(MEMHDR *);
|
|
|
void |
void |
xmlMallocBreakpoint(void) { |
xmlMallocBreakpoint(void) { |
fprintf(stderr, "xmlMallocBreakpoint reached on block %d\n", xmlMemStopAtBlock); |
xmlGenericError(xmlGenericErrorContext, |
|
"xmlMallocBreakpoint reached on block %d\n", xmlMemStopAtBlock); |
} |
} |
|
|
/** |
/** |
Line 132 xmlMallocLoc(int size, const char * file
|
Line 134 xmlMallocLoc(int size, const char * file
|
|
|
if (!xmlMemInitialized) xmlInitMemory(); |
if (!xmlMemInitialized) xmlInitMemory(); |
#ifdef DEBUG_MEMORY |
#ifdef DEBUG_MEMORY |
fprintf(stderr, "Malloc(%d)\n",size); |
xmlGenericError(xmlGenericErrorContext, |
|
"Malloc(%d)\n",size); |
#endif |
#endif |
|
|
TEST_POINT |
TEST_POINT |
Line 140 xmlMallocLoc(int size, const char * file
|
Line 143 xmlMallocLoc(int size, const char * file
|
p = (MEMHDR *) malloc(RESERVE_SIZE+size); |
p = (MEMHDR *) malloc(RESERVE_SIZE+size); |
|
|
if (!p) { |
if (!p) { |
fprintf(stderr, "xmlMalloc : Out of free space\n"); |
xmlGenericError(xmlGenericErrorContext, |
|
"xmlMalloc : Out of free space\n"); |
xmlMemoryDump(); |
xmlMemoryDump(); |
return(NULL); |
return(NULL); |
} |
} |
Line 157 xmlMallocLoc(int size, const char * file
|
Line 161 xmlMallocLoc(int size, const char * file
|
#endif |
#endif |
|
|
#ifdef DEBUG_MEMORY |
#ifdef DEBUG_MEMORY |
fprintf(stderr, "Malloc(%d) Ok\n",size); |
xmlGenericError(xmlGenericErrorContext, |
|
"Malloc(%d) Ok\n",size); |
#endif |
#endif |
|
|
if (xmlMemStopAtBlock == block) xmlMallocBreakpoint(); |
if (xmlMemStopAtBlock == block) xmlMallocBreakpoint(); |
Line 285 xmlMemFree(void *ptr)
|
Line 290 xmlMemFree(void *ptr)
|
return; |
return; |
|
|
error: |
error: |
fprintf(stderr, "xmlFree(%X) error\n", (unsigned int) ptr); |
xmlGenericError(xmlGenericErrorContext, |
|
"xmlFree(%X) error\n", (unsigned int) ptr); |
return; |
return; |
} |
} |
|
|
Line 557 void debugmem_list_delete(MEMHDR *p)
|
Line 563 void debugmem_list_delete(MEMHDR *p)
|
|
|
void debugmem_tag_error(void *p) |
void debugmem_tag_error(void *p) |
{ |
{ |
fprintf(stderr, "Memory tag error occurs :%p \n\t bye\n", p); |
xmlGenericError(xmlGenericErrorContext, |
|
"Memory tag error occurs :%p \n\t bye\n", p); |
#ifdef MEM_LIST |
#ifdef MEM_LIST |
if (stderr) |
if (stderr) |
xmlMemDisplay(stderr); |
xmlMemDisplay(stderr); |
Line 637 xmlInitMemory(void)
|
Line 644 xmlInitMemory(void)
|
#endif |
#endif |
|
|
#ifdef DEBUG_MEMORY |
#ifdef DEBUG_MEMORY |
fprintf(stderr, "xmlInitMemory() Ok\n"); |
xmlGenericError(xmlGenericErrorContext, |
|
"xmlInitMemory() Ok\n"); |
#endif |
#endif |
ret = 0; |
ret = 0; |
return(ret); |
return(ret); |