2 * xmlmemory.c: libxml memory allocator wrapper.
12 #ifdef HAVE_SYS_TYPES_H
13 #include <sys/types.h>
32 /* #define DEBUG_MEMORY */
37 * keep track of all allocated blocks for error reporting
38 * Always build the memory list !
40 #ifdef DEBUG_MEMORY_LOCATION
42 #define MEM_LIST /* keep a list of all the allocated memory blocks */
46 #include <libxml/globals.h> /* must come before xmlmemory.h */
47 #include <libxml/xmlmemory.h>
48 #include <libxml/xmlerror.h>
49 #include <libxml/threads.h>
51 static int xmlMemInitialized = 0;
52 static unsigned long debugMemSize = 0;
53 static unsigned long debugMemBlocks = 0;
54 static unsigned long debugMaxMemSize = 0;
55 static xmlMutexPtr xmlMemMutex = NULL;
57 void xmlMallocBreakpoint(void);
59 /************************************************************************
61 * Macros, variables and associated types *
63 ************************************************************************/
65 #if !defined(LIBXML_THREAD_ENABLED) && !defined(LIBXML_THREAD_ALLOC_ENABLED)
78 * Each of the blocks allocated begin with a header containing informations
84 #define REALLOC_TYPE 2
86 #define MALLOC_ATOMIC_TYPE 4
87 #define REALLOC_ATOMIC_TYPE 5
89 typedef struct memnod {
92 unsigned long mh_number;
95 struct memnod *mh_next;
96 struct memnod *mh_prev;
104 #define ALIGN_SIZE 16
106 #define ALIGN_SIZE sizeof(double)
108 #define HDR_SIZE sizeof(MEMHDR)
109 #define RESERVE_SIZE (((HDR_SIZE + (ALIGN_SIZE-1)) \
110 / ALIGN_SIZE ) * ALIGN_SIZE)
113 #define CLIENT_2_HDR(a) ((MEMHDR *) (((char *) (a)) - RESERVE_SIZE))
114 #define HDR_2_CLIENT(a) ((void *) (((char *) (a)) + RESERVE_SIZE))
117 static unsigned int block=0;
118 static unsigned int xmlMemStopAtBlock = 0;
119 static void *xmlMemTraceBlockAt = NULL;
121 static MEMHDR *memlist = NULL;
124 static void debugmem_tag_error(void *addr);
126 static void debugmem_list_add(MEMHDR *);
127 static void debugmem_list_delete(MEMHDR *);
129 #define Mem_Tag_Err(a) debugmem_tag_error(a);
136 * xmlMallocBreakpoint:
138 * Breakpoint to use in conjunction with xmlMemStopAtBlock. When the block
139 * number reaches the specified value this function is called. One need to add a breakpoint
140 * to it to get the context in which the given block is allocated.
144 xmlMallocBreakpoint(void) {
145 xmlGenericError(xmlGenericErrorContext,
146 "xmlMallocBreakpoint reached on block %d\n", xmlMemStopAtBlock);
151 * @size: an int specifying the size in byte to allocate.
152 * @file: the file name or NULL
153 * @line: the line number
155 * a malloc() equivalent, with logging of the allocation info.
157 * Returns a pointer to the allocated area or NULL in case of lack of memory.
161 xmlMallocLoc(size_t size, const char * file, int line)
166 if (!xmlMemInitialized) xmlInitMemory();
168 xmlGenericError(xmlGenericErrorContext,
169 "Malloc(%d)\n",size);
174 p = (MEMHDR *) malloc(RESERVE_SIZE+size);
177 xmlGenericError(xmlGenericErrorContext,
178 "xmlMallocLoc : Out of free space\n");
184 p->mh_type = MALLOC_TYPE;
187 xmlMutexLock(xmlMemMutex);
188 p->mh_number = ++block;
189 debugMemSize += size;
191 if (debugMemSize > debugMaxMemSize) debugMaxMemSize = debugMemSize;
193 debugmem_list_add(p);
195 xmlMutexUnlock(xmlMemMutex);
198 xmlGenericError(xmlGenericErrorContext,
199 "Malloc(%d) Ok\n",size);
202 if (xmlMemStopAtBlock == p->mh_number) xmlMallocBreakpoint();
204 ret = HDR_2_CLIENT(p);
206 if (xmlMemTraceBlockAt == ret) {
207 xmlGenericError(xmlGenericErrorContext,
208 "%p : Malloc(%ld) Ok\n", xmlMemTraceBlockAt, size);
209 xmlMallocBreakpoint();
218 * xmlMallocAtomicLoc:
219 * @size: an int specifying the size in byte to allocate.
220 * @file: the file name or NULL
221 * @line: the line number
223 * a malloc() equivalent, with logging of the allocation info.
225 * Returns a pointer to the allocated area or NULL in case of lack of memory.
229 xmlMallocAtomicLoc(size_t size, const char * file, int line)
234 if (!xmlMemInitialized) xmlInitMemory();
236 xmlGenericError(xmlGenericErrorContext,
237 "Malloc(%d)\n",size);
242 p = (MEMHDR *) malloc(RESERVE_SIZE+size);
245 xmlGenericError(xmlGenericErrorContext,
246 "xmlMallocLoc : Out of free space\n");
252 p->mh_type = MALLOC_ATOMIC_TYPE;
255 xmlMutexLock(xmlMemMutex);
256 p->mh_number = ++block;
257 debugMemSize += size;
259 if (debugMemSize > debugMaxMemSize) debugMaxMemSize = debugMemSize;
261 debugmem_list_add(p);
263 xmlMutexUnlock(xmlMemMutex);
266 xmlGenericError(xmlGenericErrorContext,
267 "Malloc(%d) Ok\n",size);
270 if (xmlMemStopAtBlock == p->mh_number) xmlMallocBreakpoint();
272 ret = HDR_2_CLIENT(p);
274 if (xmlMemTraceBlockAt == ret) {
275 xmlGenericError(xmlGenericErrorContext,
276 "%p : Malloc(%ld) Ok\n", xmlMemTraceBlockAt, size);
277 xmlMallocBreakpoint();
286 * @size: an int specifying the size in byte to allocate.
288 * a malloc() equivalent, with logging of the allocation info.
290 * Returns a pointer to the allocated area or NULL in case of lack of memory.
294 xmlMemMalloc(size_t size)
296 return(xmlMallocLoc(size, "none", 0));
301 * @ptr: the initial memory block pointer
302 * @size: an int specifying the size in byte to allocate.
303 * @file: the file name or NULL
304 * @line: the line number
306 * a realloc() equivalent, with logging of the allocation info.
308 * Returns a pointer to the allocated area or NULL in case of lack of memory.
312 xmlReallocLoc(void *ptr,size_t size, const char * file, int line)
315 unsigned long number;
321 return(xmlMallocLoc(size, file, line));
323 if (!xmlMemInitialized) xmlInitMemory();
326 p = CLIENT_2_HDR(ptr);
327 number = p->mh_number;
328 if (xmlMemStopAtBlock == number) xmlMallocBreakpoint();
329 if (p->mh_tag != MEMTAG) {
334 xmlMutexLock(xmlMemMutex);
335 debugMemSize -= p->mh_size;
338 oldsize = p->mh_size;
341 debugmem_list_delete(p);
343 xmlMutexUnlock(xmlMemMutex);
345 p = (MEMHDR *) realloc(p,RESERVE_SIZE+size);
349 if (xmlMemTraceBlockAt == ptr) {
350 xmlGenericError(xmlGenericErrorContext,
351 "%p : Realloced(%ld -> %ld) Ok\n",
352 xmlMemTraceBlockAt, p->mh_size, size);
353 xmlMallocBreakpoint();
356 p->mh_number = number;
357 p->mh_type = REALLOC_TYPE;
361 xmlMutexLock(xmlMemMutex);
362 debugMemSize += size;
364 if (debugMemSize > debugMaxMemSize) debugMaxMemSize = debugMemSize;
366 debugmem_list_add(p);
368 xmlMutexUnlock(xmlMemMutex);
373 xmlGenericError(xmlGenericErrorContext,
374 "Realloced(%d to %d) Ok\n", oldsize, size);
376 return(HDR_2_CLIENT(p));
384 * @ptr: the initial memory block pointer
385 * @size: an int specifying the size in byte to allocate.
387 * a realloc() equivalent, with logging of the allocation info.
389 * Returns a pointer to the allocated area or NULL in case of lack of memory.
393 xmlMemRealloc(void *ptr,size_t size) {
394 return(xmlReallocLoc(ptr, size, "none", 0));
399 * @ptr: the memory block pointer
401 * a free() equivalent, with error checking.
404 xmlMemFree(void *ptr)
415 if (ptr == (void *) -1) {
416 xmlGenericError(xmlGenericErrorContext,
417 "trying to free pointer from freed area\n");
421 if (xmlMemTraceBlockAt == ptr) {
422 xmlGenericError(xmlGenericErrorContext,
423 "%p : Freed()\n", xmlMemTraceBlockAt);
424 xmlMallocBreakpoint();
429 target = (char *) ptr;
431 p = CLIENT_2_HDR(ptr);
432 if (p->mh_tag != MEMTAG) {
436 if (xmlMemStopAtBlock == p->mh_number) xmlMallocBreakpoint();
438 memset(target, -1, p->mh_size);
439 xmlMutexLock(xmlMemMutex);
440 debugMemSize -= p->mh_size;
446 debugmem_list_delete(p);
448 xmlMutexUnlock(xmlMemMutex);
455 xmlGenericError(xmlGenericErrorContext,
456 "Freed(%d) Ok\n", size);
462 xmlGenericError(xmlGenericErrorContext,
463 "xmlMemFree(%lX) error\n", (unsigned long) ptr);
464 xmlMallocBreakpoint();
470 * @str: the initial string pointer
471 * @file: the file name or NULL
472 * @line: the line number
474 * a strdup() equivalent, with logging of the allocation info.
476 * Returns a pointer to the new string or NULL if allocation error occurred.
480 xmlMemStrdupLoc(const char *str, const char *file, int line)
483 size_t size = strlen(str) + 1;
486 if (!xmlMemInitialized) xmlInitMemory();
489 p = (MEMHDR *) malloc(RESERVE_SIZE+size);
495 p->mh_type = STRDUP_TYPE;
498 xmlMutexLock(xmlMemMutex);
499 p->mh_number = ++block;
500 debugMemSize += size;
502 if (debugMemSize > debugMaxMemSize) debugMaxMemSize = debugMemSize;
504 debugmem_list_add(p);
506 xmlMutexUnlock(xmlMemMutex);
508 s = (char *) HDR_2_CLIENT(p);
510 if (xmlMemStopAtBlock == p->mh_number) xmlMallocBreakpoint();
519 if (xmlMemTraceBlockAt == s) {
520 xmlGenericError(xmlGenericErrorContext,
521 "%p : Strdup() Ok\n", xmlMemTraceBlockAt);
522 xmlMallocBreakpoint();
533 * @str: the initial string pointer
535 * a strdup() equivalent, with logging of the allocation info.
537 * Returns a pointer to the new string or NULL if allocation error occurred.
541 xmlMemoryStrdup(const char *str) {
542 return(xmlMemStrdupLoc(str, "none", 0));
548 * Provides the amount of memory currently allocated
550 * Returns an int representing the amount of memory allocated.
555 return(debugMemSize);
561 * Provides the number of memory areas currently allocated
563 * Returns an int representing the number of blocks
568 return(debugMemBlocks);
574 * @fp: a FILE descriptor used as the output file
575 * @p: a memory block header
577 * tries to show some content from the memory block
581 xmlMemContentShow(FILE *fp, MEMHDR *p)
583 int i,j,k,len = p->mh_size;
584 const char *buf = (const char *) HDR_2_CLIENT(p);
587 fprintf(fp, " NULL");
591 for (i = 0;i < len;i++) {
592 if (buf[i] == 0) break;
593 if (!isprint((unsigned char) buf[i])) break;
595 if ((i < 4) && ((buf[i] != 0) || (i == 0))) {
600 for (j = 0;(j < len -3) && (j < 40);j += 4) {
601 cur = *((void **) &buf[j]);
602 q = CLIENT_2_HDR(cur);
608 if (k++ > 100) break;
610 if ((p != NULL) && (p == q)) {
611 fprintf(fp, " pointer to #%lu at index %d",
617 } else if ((i == 0) && (buf[i] == 0)) {
620 if (buf[i] == 0) fprintf(fp," \"%.25s\"", buf);
623 for (j = 0;j < i;j++)
624 fprintf(fp,"%c", buf[j]);
633 * @fp: a FILE descriptor used as the output file, if NULL, the result is
634 * written to the file .memorylist
635 * @nbBytes: the amount of memory to dump
637 * the last nbBytes of memory allocated and not freed, useful for dumping
638 * the memory left allocated between two places at runtime.
642 xmlMemDisplayLast(FILE *fp, long nbBytes)
655 fp = fopen(".memorylist", "w");
661 fprintf(fp," Last %li MEMORY ALLOCATED : %lu, MAX was %lu\n",
662 nbBytes, debugMemSize, debugMaxMemSize);
663 fprintf(fp,"BLOCK NUMBER SIZE TYPE\n");
665 xmlMutexLock(xmlMemMutex);
667 while ((p) && (nbBytes > 0)) {
668 fprintf(fp,"%-5u %6lu %6lu ",idx++,p->mh_number,
669 (unsigned long)p->mh_size);
670 switch (p->mh_type) {
671 case STRDUP_TYPE:fprintf(fp,"strdup() in ");break;
672 case MALLOC_TYPE:fprintf(fp,"malloc() in ");break;
673 case REALLOC_TYPE:fprintf(fp,"realloc() in ");break;
674 case MALLOC_ATOMIC_TYPE:fprintf(fp,"atomicmalloc() in ");break;
675 case REALLOC_ATOMIC_TYPE:fprintf(fp,"atomicrealloc() in ");break;
677 fprintf(fp,"Unknown memory block, may be corrupted");
678 xmlMutexUnlock(xmlMemMutex);
683 if (p->mh_file != NULL) fprintf(fp,"%s(%u)", p->mh_file, p->mh_line);
684 if (p->mh_tag != MEMTAG)
685 fprintf(fp," INVALID");
688 xmlMemContentShow(fp, p);
693 nbBytes -= (unsigned long)p->mh_size;
696 xmlMutexUnlock(xmlMemMutex);
698 fprintf(fp,"Memory list not compiled (MEM_LIST not defined !)\n");
706 * @fp: a FILE descriptor used as the output file, if NULL, the result is
707 * written to the file .memorylist
709 * show in-extenso the memory blocks allocated
713 xmlMemDisplay(FILE *fp)
719 #if defined(HAVE_LOCALTIME) && defined(HAVE_STRFTIME)
728 fp = fopen(".memorylist", "w");
734 #if defined(HAVE_LOCALTIME) && defined(HAVE_STRFTIME)
735 currentTime = time(NULL);
736 tstruct = localtime(¤tTime);
737 strftime(buf, sizeof(buf) - 1, "%I:%M:%S %p", tstruct);
738 fprintf(fp," %s\n\n", buf);
742 fprintf(fp," MEMORY ALLOCATED : %lu, MAX was %lu\n",
743 debugMemSize, debugMaxMemSize);
744 fprintf(fp,"BLOCK NUMBER SIZE TYPE\n");
746 xmlMutexLock(xmlMemMutex);
749 fprintf(fp,"%-5u %6lu %6lu ",idx++,p->mh_number,
750 (unsigned long)p->mh_size);
751 switch (p->mh_type) {
752 case STRDUP_TYPE:fprintf(fp,"strdup() in ");break;
753 case MALLOC_TYPE:fprintf(fp,"malloc() in ");break;
754 case REALLOC_TYPE:fprintf(fp,"realloc() in ");break;
755 case MALLOC_ATOMIC_TYPE:fprintf(fp,"atomicmalloc() in ");break;
756 case REALLOC_ATOMIC_TYPE:fprintf(fp,"atomicrealloc() in ");break;
758 fprintf(fp,"Unknown memory block, may be corrupted");
759 xmlMutexUnlock(xmlMemMutex);
764 if (p->mh_file != NULL) fprintf(fp,"%s(%u)", p->mh_file, p->mh_line);
765 if (p->mh_tag != MEMTAG)
766 fprintf(fp," INVALID");
769 xmlMemContentShow(fp, p);
776 xmlMutexUnlock(xmlMemMutex);
778 fprintf(fp,"Memory list not compiled (MEM_LIST not defined !)\n");
786 static void debugmem_list_add(MEMHDR *p)
788 p->mh_next = memlist;
790 if (memlist) memlist->mh_prev = p;
792 #ifdef MEM_LIST_DEBUG
798 static void debugmem_list_delete(MEMHDR *p)
801 p->mh_next->mh_prev = p->mh_prev;
803 p->mh_prev->mh_next = p->mh_next;
804 else memlist = p->mh_next;
805 #ifdef MEM_LIST_DEBUG
814 * debugmem_tag_error:
816 * internal error function.
819 static void debugmem_tag_error(void *p)
821 xmlGenericError(xmlGenericErrorContext,
822 "Memory tag error occurs :%p \n\t bye\n", p);
825 xmlMemDisplay(stderr);
830 static FILE *xmlMemoryDumpFile = NULL;
835 * @fp: a FILE descriptor used as the output file
836 * @nr: number of entries to dump
838 * show a show display of the memory allocated, and dump
839 * the @nr last allocated areas which were not freed
843 xmlMemShow(FILE *fp, int nr ATTRIBUTE_UNUSED)
850 fprintf(fp," MEMORY ALLOCATED : %lu, MAX was %lu\n",
851 debugMemSize, debugMaxMemSize);
853 xmlMutexLock(xmlMemMutex);
855 fprintf(fp,"NUMBER SIZE TYPE WHERE\n");
857 while ((p) && nr > 0) {
858 fprintf(fp,"%6lu %6lu ",p->mh_number,(unsigned long)p->mh_size);
859 switch (p->mh_type) {
860 case STRDUP_TYPE:fprintf(fp,"strdup() in ");break;
861 case MALLOC_TYPE:fprintf(fp,"malloc() in ");break;
862 case MALLOC_ATOMIC_TYPE:fprintf(fp,"atomicmalloc() in ");break;
863 case REALLOC_TYPE:fprintf(fp,"realloc() in ");break;
864 case REALLOC_ATOMIC_TYPE:fprintf(fp,"atomicrealloc() in ");break;
865 default:fprintf(fp," ??? in ");break;
867 if (p->mh_file != NULL)
868 fprintf(fp,"%s(%u)", p->mh_file, p->mh_line);
869 if (p->mh_tag != MEMTAG)
870 fprintf(fp," INVALID");
871 xmlMemContentShow(fp, p);
877 xmlMutexUnlock(xmlMemMutex);
878 #endif /* MEM_LIST */
884 * Dump in-extenso the memory blocks allocated to the file .memorylist
893 if (debugMaxMemSize == 0)
895 dump = fopen(".memdump", "w");
897 xmlMemoryDumpFile = stderr;
898 else xmlMemoryDumpFile = dump;
900 xmlMemDisplay(xmlMemoryDumpFile);
902 if (dump != NULL) fclose(dump);
903 #endif /* MEM_LIST */
907 /****************************************************************
909 * Initialization Routines *
911 ****************************************************************/
916 * Initialize the memory layer.
918 * Returns 0 on success
927 xmlGenericError(xmlGenericErrorContext,
928 "xmlInitMemory()\n");
931 This is really not good code (see Bug 130419). Suggestions for
932 improvement will be welcome!
934 if (xmlMemInitialized) return(-1);
935 xmlMemInitialized = 1;
936 xmlMemMutex = xmlNewMutex();
939 breakpoint = getenv("XML_MEM_BREAKPOINT");
940 if (breakpoint != NULL) {
941 sscanf(breakpoint, "%ud", &xmlMemStopAtBlock);
945 breakpoint = getenv("XML_MEM_TRACE");
946 if (breakpoint != NULL) {
947 sscanf(breakpoint, "%p", &xmlMemTraceBlockAt);
952 xmlGenericError(xmlGenericErrorContext,
953 "xmlInitMemory() Ok\n");
961 * Free up all the memory allocated by the library for its own
962 * use. This should not be called by user level code.
965 xmlCleanupMemory(void) {
967 xmlGenericError(xmlGenericErrorContext,
968 "xmlCleanupMemory()\n");
970 if (xmlMemInitialized == 0)
973 xmlFreeMutex(xmlMemMutex);
975 xmlMemInitialized = 0;
977 xmlGenericError(xmlGenericErrorContext,
978 "xmlCleanupMemory() Ok\n");
984 * @freeFunc: the free() function to use
985 * @mallocFunc: the malloc() function to use
986 * @reallocFunc: the realloc() function to use
987 * @strdupFunc: the strdup() function to use
989 * Override the default memory access functions with a new set
990 * This has to be called before any other libxml routines !
992 * Should this be blocked if there was already some allocations
995 * Returns 0 on success
998 xmlMemSetup(xmlFreeFunc freeFunc, xmlMallocFunc mallocFunc,
999 xmlReallocFunc reallocFunc, xmlStrdupFunc strdupFunc) {
1001 xmlGenericError(xmlGenericErrorContext,
1004 if (freeFunc == NULL)
1006 if (mallocFunc == NULL)
1008 if (reallocFunc == NULL)
1010 if (strdupFunc == NULL)
1013 xmlMalloc = mallocFunc;
1014 xmlMallocAtomic = mallocFunc;
1015 xmlRealloc = reallocFunc;
1016 xmlMemStrdup = strdupFunc;
1018 xmlGenericError(xmlGenericErrorContext,
1019 "xmlMemSetup() Ok\n");
1026 * @freeFunc: place to save the free() function in use
1027 * @mallocFunc: place to save the malloc() function in use
1028 * @reallocFunc: place to save the realloc() function in use
1029 * @strdupFunc: place to save the strdup() function in use
1031 * Provides the memory access functions set currently in use
1033 * Returns 0 on success
1036 xmlMemGet(xmlFreeFunc *freeFunc, xmlMallocFunc *mallocFunc,
1037 xmlReallocFunc *reallocFunc, xmlStrdupFunc *strdupFunc) {
1038 if (freeFunc != NULL) *freeFunc = xmlFree;
1039 if (mallocFunc != NULL) *mallocFunc = xmlMalloc;
1040 if (reallocFunc != NULL) *reallocFunc = xmlRealloc;
1041 if (strdupFunc != NULL) *strdupFunc = xmlMemStrdup;
1047 * @freeFunc: the free() function to use
1048 * @mallocFunc: the malloc() function to use
1049 * @mallocAtomicFunc: the malloc() function to use for atomic allocations
1050 * @reallocFunc: the realloc() function to use
1051 * @strdupFunc: the strdup() function to use
1053 * Override the default memory access functions with a new set
1054 * This has to be called before any other libxml routines !
1055 * The mallocAtomicFunc is specialized for atomic block
1056 * allocations (i.e. of areas useful for garbage collected memory allocators
1058 * Should this be blocked if there was already some allocations
1061 * Returns 0 on success
1064 xmlGcMemSetup(xmlFreeFunc freeFunc, xmlMallocFunc mallocFunc,
1065 xmlMallocFunc mallocAtomicFunc, xmlReallocFunc reallocFunc,
1066 xmlStrdupFunc strdupFunc) {
1068 xmlGenericError(xmlGenericErrorContext,
1069 "xmlGcMemSetup()\n");
1071 if (freeFunc == NULL)
1073 if (mallocFunc == NULL)
1075 if (mallocAtomicFunc == NULL)
1077 if (reallocFunc == NULL)
1079 if (strdupFunc == NULL)
1082 xmlMalloc = mallocFunc;
1083 xmlMallocAtomic = mallocAtomicFunc;
1084 xmlRealloc = reallocFunc;
1085 xmlMemStrdup = strdupFunc;
1087 xmlGenericError(xmlGenericErrorContext,
1088 "xmlGcMemSetup() Ok\n");
1095 * @freeFunc: place to save the free() function in use
1096 * @mallocFunc: place to save the malloc() function in use
1097 * @mallocAtomicFunc: place to save the atomic malloc() function in use
1098 * @reallocFunc: place to save the realloc() function in use
1099 * @strdupFunc: place to save the strdup() function in use
1101 * Provides the memory access functions set currently in use
1102 * The mallocAtomicFunc is specialized for atomic block
1103 * allocations (i.e. of areas useful for garbage collected memory allocators
1105 * Returns 0 on success
1108 xmlGcMemGet(xmlFreeFunc *freeFunc, xmlMallocFunc *mallocFunc,
1109 xmlMallocFunc *mallocAtomicFunc, xmlReallocFunc *reallocFunc,
1110 xmlStrdupFunc *strdupFunc) {
1111 if (freeFunc != NULL) *freeFunc = xmlFree;
1112 if (mallocFunc != NULL) *mallocFunc = xmlMalloc;
1113 if (mallocAtomicFunc != NULL) *mallocAtomicFunc = xmlMallocAtomic;
1114 if (reallocFunc != NULL) *reallocFunc = xmlRealloc;
1115 if (strdupFunc != NULL) *strdupFunc = xmlMemStrdup;
1119 #define bottom_xmlmemory
1120 #include "elfgcchack.h"