ReactOS 0.4.16-dev-2206-gc56950d
xmlmemory.c
Go to the documentation of this file.
1/*
2 * xmlmemory.c: libxml memory allocator wrapper.
3 *
4 * daniel@veillard.com
5 */
6
7#define IN_LIBXML
8#include "libxml.h"
9
10#include <string.h>
11#include <stdlib.h>
12#include <ctype.h>
13#include <time.h>
14
21#ifdef DEBUG_MEMORY_LOCATION
22#ifndef MEM_LIST
23#define MEM_LIST /* keep a list of all the allocated memory blocks */
24#endif
25#endif
26
27#include <libxml/xmlmemory.h>
28#include <libxml/xmlerror.h>
29#include <libxml/parser.h>
30#include <libxml/threads.h>
31
32#include "private/memory.h"
33#include "private/threads.h"
34
35static unsigned long debugMemSize = 0;
36static unsigned long debugMemBlocks = 0;
37static unsigned long debugMaxMemSize = 0;
39
40void xmlMallocBreakpoint(void);
41
42/************************************************************************
43 * *
44 * Macros, variables and associated types *
45 * *
46 ************************************************************************/
47
48#if !defined(LIBXML_THREAD_ENABLED) && !defined(LIBXML_THREAD_ALLOC_ENABLED)
49#ifdef xmlMalloc
50#undef xmlMalloc
51#endif
52#ifdef xmlRealloc
53#undef xmlRealloc
54#endif
55#ifdef xmlMemStrdup
56#undef xmlMemStrdup
57#endif
58#endif
59
60/*
61 * Each of the blocks allocated begin with a header containing information
62 */
63
64#define MEMTAG 0x5aa5U
65
66#define MALLOC_TYPE 1
67#define REALLOC_TYPE 2
68#define STRDUP_TYPE 3
69#define MALLOC_ATOMIC_TYPE 4
70#define REALLOC_ATOMIC_TYPE 5
71
72typedef struct memnod {
73 unsigned int mh_tag;
74 unsigned int mh_type;
75 unsigned long mh_number;
76 size_t mh_size;
77#ifdef MEM_LIST
78 struct memnod *mh_next;
79 struct memnod *mh_prev;
80#endif
81 const char *mh_file;
82 unsigned int mh_line;
84
85
86#ifdef SUN4
87#define ALIGN_SIZE 16
88#else
89#define ALIGN_SIZE sizeof(double)
90#endif
91#define HDR_SIZE sizeof(MEMHDR)
92#define RESERVE_SIZE (((HDR_SIZE + (ALIGN_SIZE-1)) \
93 / ALIGN_SIZE ) * ALIGN_SIZE)
94
95#define MAX_SIZE_T ((size_t)-1)
96
97#define CLIENT_2_HDR(a) ((void *) (((char *) (a)) - RESERVE_SIZE))
98#define HDR_2_CLIENT(a) ((void *) (((char *) (a)) + RESERVE_SIZE))
99
100
101static unsigned int block=0;
102static unsigned int xmlMemStopAtBlock = 0;
104#ifdef MEM_LIST
105static MEMHDR *memlist = NULL;
106#endif
107
108static void debugmem_tag_error(void *addr);
109#ifdef MEM_LIST
110static void debugmem_list_add(MEMHDR *);
111static void debugmem_list_delete(MEMHDR *);
112#endif
113#define Mem_Tag_Err(a) debugmem_tag_error(a);
114
115#ifndef TEST_POINT
116#define TEST_POINT
117#endif
118
127void
130 "xmlMallocBreakpoint reached on block %d\n", xmlMemStopAtBlock);
131}
132
144void *
145xmlMallocLoc(size_t size, const char * file, int line)
146{
147 MEMHDR *p;
148 void *ret;
149
151
153
154 if (size > (MAX_SIZE_T - RESERVE_SIZE)) {
156 "xmlMallocLoc : Unsigned overflow\n");
157 return(NULL);
158 }
159
161
162 if (!p) {
164 "xmlMallocLoc : Out of free space\n");
165 return(NULL);
166 }
167 p->mh_tag = MEMTAG;
168 p->mh_size = size;
169 p->mh_type = MALLOC_TYPE;
170 p->mh_file = file;
171 p->mh_line = line;
173 p->mh_number = ++block;
177#ifdef MEM_LIST
178 debugmem_list_add(p);
179#endif
181
182 if (xmlMemStopAtBlock == p->mh_number) xmlMallocBreakpoint();
183
184 ret = HDR_2_CLIENT(p);
185
186 if (xmlMemTraceBlockAt == ret) {
188 "%p : Malloc(%lu) Ok\n", xmlMemTraceBlockAt,
189 (long unsigned)size);
191 }
192
194
195 return(ret);
196}
197
209void *
210xmlMallocAtomicLoc(size_t size, const char * file, int line)
211{
212 MEMHDR *p;
213 void *ret;
214
216
218
219 if (size > (MAX_SIZE_T - RESERVE_SIZE)) {
221 "xmlMallocAtomicLoc : Unsigned overflow\n");
222 return(NULL);
223 }
224
226
227 if (!p) {
229 "xmlMallocAtomicLoc : Out of free space\n");
230 return(NULL);
231 }
232 p->mh_tag = MEMTAG;
233 p->mh_size = size;
234 p->mh_type = MALLOC_ATOMIC_TYPE;
235 p->mh_file = file;
236 p->mh_line = line;
238 p->mh_number = ++block;
242#ifdef MEM_LIST
243 debugmem_list_add(p);
244#endif
246
247 if (xmlMemStopAtBlock == p->mh_number) xmlMallocBreakpoint();
248
249 ret = HDR_2_CLIENT(p);
250
251 if (xmlMemTraceBlockAt == ret) {
253 "%p : Malloc(%lu) Ok\n", xmlMemTraceBlockAt,
254 (long unsigned)size);
256 }
257
259
260 return(ret);
261}
271void *
273{
274 return(xmlMallocLoc(size, "none", 0));
275}
276
289void *
290xmlReallocLoc(void *ptr,size_t size, const char * file, int line)
291{
292 MEMHDR *p, *tmp;
293 unsigned long number;
294
295 if (ptr == NULL)
296 return(xmlMallocLoc(size, file, line));
297
300
301 p = CLIENT_2_HDR(ptr);
302 number = p->mh_number;
304 if (p->mh_tag != MEMTAG) {
305 Mem_Tag_Err(p);
306 goto error;
307 }
308 p->mh_tag = ~MEMTAG;
310 debugMemSize -= p->mh_size;
312#ifdef MEM_LIST
313 debugmem_list_delete(p);
314#endif
316
317 if (size > (MAX_SIZE_T - RESERVE_SIZE)) {
319 "xmlReallocLoc : Unsigned overflow\n");
320 return(NULL);
321 }
322
323 tmp = (MEMHDR *) realloc(p,RESERVE_SIZE+size);
324 if (!tmp) {
325 free(p);
326 goto error;
327 }
328 p = tmp;
329 if (xmlMemTraceBlockAt == ptr) {
331 "%p : Realloced(%lu -> %lu) Ok\n",
332 xmlMemTraceBlockAt, (long unsigned)p->mh_size,
333 (long unsigned)size);
335 }
336 p->mh_tag = MEMTAG;
337 p->mh_number = number;
338 p->mh_type = REALLOC_TYPE;
339 p->mh_size = size;
340 p->mh_file = file;
341 p->mh_line = line;
346#ifdef MEM_LIST
347 debugmem_list_add(p);
348#endif
350
352
353 return(HDR_2_CLIENT(p));
354
355error:
356 return(NULL);
357}
358
369void *
370xmlMemRealloc(void *ptr,size_t size) {
371 return(xmlReallocLoc(ptr, size, "none", 0));
372}
373
380void
382{
383 MEMHDR *p;
384 char *target;
385
386 if (ptr == NULL)
387 return;
388
389 if (ptr == (void *) -1) {
391 "trying to free pointer from freed area\n");
392 goto error;
393 }
394
395 if (xmlMemTraceBlockAt == ptr) {
397 "%p : Freed()\n", xmlMemTraceBlockAt);
399 }
400
402
403 target = (char *) ptr;
404
405 p = CLIENT_2_HDR(ptr);
406 if (p->mh_tag != MEMTAG) {
407 Mem_Tag_Err(p);
408 goto error;
409 }
410 if (xmlMemStopAtBlock == p->mh_number) xmlMallocBreakpoint();
411 p->mh_tag = ~MEMTAG;
412 memset(target, -1, p->mh_size);
414 debugMemSize -= p->mh_size;
416#ifdef MEM_LIST
417 debugmem_list_delete(p);
418#endif
420
421 free(p);
422
424
425 return;
426
427error:
429 "xmlMemFree(%p) error\n", ptr);
431 return;
432}
433
445char *
446xmlMemStrdupLoc(const char *str, const char *file, int line)
447{
448 char *s;
449 size_t size = strlen(str) + 1;
450 MEMHDR *p;
451
454
455 if (size > (MAX_SIZE_T - RESERVE_SIZE)) {
457 "xmlMemStrdupLoc : Unsigned overflow\n");
458 return(NULL);
459 }
460
462 if (!p) {
463 goto error;
464 }
465 p->mh_tag = MEMTAG;
466 p->mh_size = size;
467 p->mh_type = STRDUP_TYPE;
468 p->mh_file = file;
469 p->mh_line = line;
471 p->mh_number = ++block;
475#ifdef MEM_LIST
476 debugmem_list_add(p);
477#endif
479
480 s = (char *) HDR_2_CLIENT(p);
481
482 if (xmlMemStopAtBlock == p->mh_number) xmlMallocBreakpoint();
483
484 strcpy(s,str);
485
487
488 if (xmlMemTraceBlockAt == s) {
490 "%p : Strdup() Ok\n", xmlMemTraceBlockAt);
492 }
493
494 return(s);
495
496error:
497 return(NULL);
498}
499
509char *
510xmlMemoryStrdup(const char *str) {
511 return(xmlMemStrdupLoc(str, "none", 0));
512}
513
521size_t
523 MEMHDR *p;
524
525 if (ptr == NULL)
526 return(0);
527
528 p = CLIENT_2_HDR(ptr);
529 if (p->mh_tag != MEMTAG)
530 return(0);
531
532 return(p->mh_size);
533}
534
543int
545 return(debugMemSize);
546}
547
556int
558 int res;
559
563 return(res);
564}
565
576void
577xmlMemDisplayLast(FILE *fp, long nbBytes)
578{
579#ifdef MEM_LIST
580 MEMHDR *p;
581 unsigned idx;
582 int nb = 0;
583#endif
584 FILE *old_fp = fp;
585
586 if (nbBytes <= 0)
587 return;
588
589 if (fp == NULL) {
590 fp = fopen(".memorylist", "w");
591 if (fp == NULL)
592 return;
593 }
594
595#ifdef MEM_LIST
596 fprintf(fp," Last %li MEMORY ALLOCATED : %lu, MAX was %lu\n",
597 nbBytes, debugMemSize, debugMaxMemSize);
598 fprintf(fp,"BLOCK NUMBER SIZE TYPE\n");
599 idx = 0;
601 p = memlist;
602 while ((p) && (nbBytes > 0)) {
603 fprintf(fp,"%-5u %6lu %6lu ",idx++,p->mh_number,
604 (unsigned long)p->mh_size);
605 switch (p->mh_type) {
606 case STRDUP_TYPE:fprintf(fp,"strdup() in ");break;
607 case MALLOC_TYPE:fprintf(fp,"malloc() in ");break;
608 case REALLOC_TYPE:fprintf(fp,"realloc() in ");break;
609 case MALLOC_ATOMIC_TYPE:fprintf(fp,"atomicmalloc() in ");break;
610 case REALLOC_ATOMIC_TYPE:fprintf(fp,"atomicrealloc() in ");break;
611 default:
612 fprintf(fp,"Unknown memory block, may be corrupted");
614 if (old_fp == NULL)
615 fclose(fp);
616 return;
617 }
618 if (p->mh_file != NULL) fprintf(fp,"%s(%u)", p->mh_file, p->mh_line);
619 if (p->mh_tag != MEMTAG)
620 fprintf(fp," INVALID");
621 nb++;
622
623 fprintf(fp,"\n");
624 nbBytes -= (unsigned long)p->mh_size;
625 p = p->mh_next;
626 }
628#else
629 fprintf(fp,"Memory list not compiled (MEM_LIST not defined !)\n");
630#endif
631 if (old_fp == NULL)
632 fclose(fp);
633}
634
643void
645{
646#ifdef MEM_LIST
647 MEMHDR *p;
648 unsigned idx;
649 int nb = 0;
650 time_t currentTime;
651 char buf[500];
652 struct tm * tstruct;
653#endif
654 FILE *old_fp = fp;
655
656 if (fp == NULL) {
657 fp = fopen(".memorylist", "w");
658 if (fp == NULL)
659 return;
660 }
661
662#ifdef MEM_LIST
663 currentTime = time(NULL);
664 tstruct = localtime(&currentTime);
665 strftime(buf, sizeof(buf) - 1, "%I:%M:%S %p", tstruct);
666 fprintf(fp," %s\n\n", buf);
667
668
669 fprintf(fp," MEMORY ALLOCATED : %lu, MAX was %lu\n",
671 fprintf(fp,"BLOCK NUMBER SIZE TYPE\n");
672 idx = 0;
674 p = memlist;
675 while (p) {
676 fprintf(fp,"%-5u %6lu %6lu ",idx++,p->mh_number,
677 (unsigned long)p->mh_size);
678 switch (p->mh_type) {
679 case STRDUP_TYPE:fprintf(fp,"strdup() in ");break;
680 case MALLOC_TYPE:fprintf(fp,"malloc() in ");break;
681 case REALLOC_TYPE:fprintf(fp,"realloc() in ");break;
682 case MALLOC_ATOMIC_TYPE:fprintf(fp,"atomicmalloc() in ");break;
683 case REALLOC_ATOMIC_TYPE:fprintf(fp,"atomicrealloc() in ");break;
684 default:
685 fprintf(fp,"Unknown memory block, may be corrupted");
687 if (old_fp == NULL)
688 fclose(fp);
689 return;
690 }
691 if (p->mh_file != NULL) fprintf(fp,"%s(%u)", p->mh_file, p->mh_line);
692 if (p->mh_tag != MEMTAG)
693 fprintf(fp," INVALID");
694 nb++;
695
696 fprintf(fp,"\n");
697 p = p->mh_next;
698 }
700#else
701 fprintf(fp,"Memory list not compiled (MEM_LIST not defined !)\n");
702#endif
703 if (old_fp == NULL)
704 fclose(fp);
705}
706
707#ifdef MEM_LIST
708
709static void debugmem_list_add(MEMHDR *p)
710{
711 p->mh_next = memlist;
712 p->mh_prev = NULL;
713 if (memlist) memlist->mh_prev = p;
714 memlist = p;
715}
716
717static void debugmem_list_delete(MEMHDR *p)
718{
719 if (p->mh_next)
720 p->mh_next->mh_prev = p->mh_prev;
721 if (p->mh_prev)
722 p->mh_prev->mh_next = p->mh_next;
723 else memlist = p->mh_next;
724}
725
726#endif
727
728/*
729 * debugmem_tag_error:
730 *
731 * internal error function.
732 */
733
734static void debugmem_tag_error(void *p)
735{
737 "Memory tag error occurs :%p \n\t bye\n", p);
738#ifdef MEM_LIST
739 if (stderr)
741#endif
742}
743
744#ifdef MEM_LIST
745static FILE *xmlMemoryDumpFile = NULL;
746#endif
747
757void
759{
760#ifdef MEM_LIST
761 MEMHDR *p;
762#endif
763
764 if (fp != NULL)
765 fprintf(fp," MEMORY ALLOCATED : %lu, MAX was %lu\n",
767#ifdef MEM_LIST
769 if (nr > 0) {
770 fprintf(fp,"NUMBER SIZE TYPE WHERE\n");
771 p = memlist;
772 while ((p) && nr > 0) {
773 fprintf(fp,"%6lu %6lu ",p->mh_number,(unsigned long)p->mh_size);
774 switch (p->mh_type) {
775 case STRDUP_TYPE:fprintf(fp,"strdup() in ");break;
776 case MALLOC_TYPE:fprintf(fp,"malloc() in ");break;
777 case MALLOC_ATOMIC_TYPE:fprintf(fp,"atomicmalloc() in ");break;
778 case REALLOC_TYPE:fprintf(fp,"realloc() in ");break;
779 case REALLOC_ATOMIC_TYPE:fprintf(fp,"atomicrealloc() in ");break;
780 default:fprintf(fp," ??? in ");break;
781 }
782 if (p->mh_file != NULL)
783 fprintf(fp,"%s(%u)", p->mh_file, p->mh_line);
784 if (p->mh_tag != MEMTAG)
785 fprintf(fp," INVALID");
786 fprintf(fp,"\n");
787 nr--;
788 p = p->mh_next;
789 }
790 }
792#endif /* MEM_LIST */
793}
794
801void
803{
804#ifdef MEM_LIST
805 FILE *dump;
806
807 if (debugMaxMemSize == 0)
808 return;
809 dump = fopen(".memdump", "w");
810 if (dump == NULL)
811 xmlMemoryDumpFile = stderr;
812 else xmlMemoryDumpFile = dump;
813
814 xmlMemDisplay(xmlMemoryDumpFile);
815
816 if (dump != NULL) fclose(dump);
817#endif /* MEM_LIST */
818}
819
820
821/****************************************************************
822 * *
823 * Initialization Routines *
824 * *
825 ****************************************************************/
826
832int
835 return(0);
836}
837
845void
847 char *breakpoint;
849
850 breakpoint = getenv("XML_MEM_BREAKPOINT");
851 if (breakpoint != NULL) {
853 }
854 breakpoint = getenv("XML_MEM_TRACE");
855 if (breakpoint != NULL) {
857 }
858
859}
860
869void
871}
872
879void
881 /*
882 * Don't clean up mutex on Windows. Global state destructors can call
883 * malloc functions after xmlCleanupParser was called. If memory
884 * debugging is enabled, xmlMemMutex can be used after cleanup.
885 *
886 * See python/tests/thread2.py
887 */
888#if !defined(LIBXML_THREAD_ENABLED) || !defined(_WIN32)
890#endif
891}
892
908int
909xmlMemSetup(xmlFreeFunc freeFunc, xmlMallocFunc mallocFunc,
910 xmlReallocFunc reallocFunc, xmlStrdupFunc strdupFunc) {
911 if (freeFunc == NULL)
912 return(-1);
913 if (mallocFunc == NULL)
914 return(-1);
915 if (reallocFunc == NULL)
916 return(-1);
917 if (strdupFunc == NULL)
918 return(-1);
919 xmlFree = freeFunc;
920 xmlMalloc = mallocFunc;
921 xmlMallocAtomic = mallocFunc;
922 xmlRealloc = reallocFunc;
923 xmlMemStrdup = strdupFunc;
924 return(0);
925}
926
938int
939xmlMemGet(xmlFreeFunc *freeFunc, xmlMallocFunc *mallocFunc,
940 xmlReallocFunc *reallocFunc, xmlStrdupFunc *strdupFunc) {
941 if (freeFunc != NULL) *freeFunc = xmlFree;
942 if (mallocFunc != NULL) *mallocFunc = xmlMalloc;
943 if (reallocFunc != NULL) *reallocFunc = xmlRealloc;
944 if (strdupFunc != NULL) *strdupFunc = xmlMemStrdup;
945 return(0);
946}
947
966int
967xmlGcMemSetup(xmlFreeFunc freeFunc, xmlMallocFunc mallocFunc,
968 xmlMallocFunc mallocAtomicFunc, xmlReallocFunc reallocFunc,
969 xmlStrdupFunc strdupFunc) {
970 if (freeFunc == NULL)
971 return(-1);
972 if (mallocFunc == NULL)
973 return(-1);
974 if (mallocAtomicFunc == NULL)
975 return(-1);
976 if (reallocFunc == NULL)
977 return(-1);
978 if (strdupFunc == NULL)
979 return(-1);
980 xmlFree = freeFunc;
981 xmlMalloc = mallocFunc;
982 xmlMallocAtomic = mallocAtomicFunc;
983 xmlRealloc = reallocFunc;
984 xmlMemStrdup = strdupFunc;
985 return(0);
986}
987
1002int
1003xmlGcMemGet(xmlFreeFunc *freeFunc, xmlMallocFunc *mallocFunc,
1004 xmlMallocFunc *mallocAtomicFunc, xmlReallocFunc *reallocFunc,
1005 xmlStrdupFunc *strdupFunc) {
1006 if (freeFunc != NULL) *freeFunc = xmlFree;
1007 if (mallocFunc != NULL) *mallocFunc = xmlMalloc;
1008 if (mallocAtomicFunc != NULL) *mallocAtomicFunc = xmlMallocAtomic;
1009 if (reallocFunc != NULL) *reallocFunc = xmlRealloc;
1010 if (strdupFunc != NULL) *strdupFunc = xmlMemStrdup;
1011 return(0);
1012}
#define realloc
Definition: debug_ros.c:6
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
#define NULL
Definition: types.h:112
unsigned int idx
Definition: utils.c:41
char *CDECL getenv(const char *name)
Definition: environ.c:227
int CDECL fclose(FILE *file)
Definition: file.c:3757
int WINAPIV fprintf(FILE *file, const char *format,...)
Definition: file.c:5549
FILE *CDECL fopen(const char *path, const char *mode)
Definition: file.c:4310
__time32_t time_t
Definition: corecrt.h:228
#define stderr
_ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl sscanf(const char *, const char *,...) __WINE_CRT_SCANF_ATTR(2
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1592
_ACRTIMP size_t __cdecl strftime(char *, size_t, const char *, const struct tm *)
Definition: time.c:1537
static struct tm * localtime(const time_t *t)
Definition: time.h:121
return ret
Definition: mutex.c:146
GLdouble s
Definition: gl.h:2039
GLuint res
Definition: glext.h:9613
GLsizeiptr size
Definition: glext.h:5919
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLenum const GLvoid * addr
Definition: glext.h:9621
GLfloat GLfloat p
Definition: glext.h:8902
#define ATTRIBUTE_UNUSED
Definition: i386-dis.c:36
void breakpoint(void)
XMLPUBFUN void xmlMutexLock(xmlMutexPtr tok)
Definition: threads.c:201
XMLPUBFUN void xmlMutexUnlock(xmlMutexPtr tok)
Definition: threads.c:225
__u16 time
Definition: mkdosfs.c:8
#define error(str)
Definition: mkdosfs.c:1605
static PVOID ptr
Definition: dispmode.c:27
ULONG nr
Definition: thread.c:7
static unsigned int number
Definition: dsound.c:1479
static void dump(const void *ptr, unsigned len)
Definition: msc.c:95
XML_HIDDEN void xmlCleanupMutex(xmlMutexPtr mutex)
Definition: threads.c:166
XML_HIDDEN void xmlInitMutex(xmlMutexPtr mutex)
Definition: threads.c:128
#define long
Definition: qsort.c:33
const WCHAR * str
strcpy
Definition: string.h:131
void * xmlGenericErrorContext
Definition: globals.c:410
xmlReallocFunc xmlRealloc
Definition: globals.c:214
xmlFreeFunc xmlFree
Definition: globals.c:184
xmlGenericErrorFunc xmlGenericError
Definition: globals.c:396
xmlMallocFunc xmlMalloc
Definition: globals.c:193
xmlMallocFunc xmlMallocAtomic
Definition: globals.c:204
xmlStrdupFunc xmlMemStrdup
Definition: globals.c:235
XML_GLOBALS_PARSER XMLPUBFUN void xmlInitParser(void)
Definition: threads.c:569
#define memset(x, y, z)
Definition: compat.h:39
Definition: fci.c:127
Definition: parser.c:49
unsigned long mh_number
Definition: xmlmemory.c:75
unsigned int mh_type
Definition: xmlmemory.c:74
const char * mh_file
Definition: xmlmemory.c:81
unsigned int mh_line
Definition: xmlmemory.c:82
unsigned int mh_tag
Definition: xmlmemory.c:73
size_t mh_size
Definition: xmlmemory.c:76
Definition: tools.h:99
void * xmlMallocAtomicLoc(size_t size, const char *file, int line)
Definition: xmlmemory.c:210
int xmlMemUsed(void)
Definition: xmlmemory.c:544
void xmlMallocBreakpoint(void)
Definition: xmlmemory.c:128
#define MALLOC_TYPE
Definition: xmlmemory.c:66
void xmlMemFree(void *ptr)
Definition: xmlmemory.c:381
void * xmlMemMalloc(size_t size)
Definition: xmlmemory.c:272
#define MALLOC_ATOMIC_TYPE
Definition: xmlmemory.c:69
void * xmlMemRealloc(void *ptr, size_t size)
Definition: xmlmemory.c:370
void xmlCleanupMemoryInternal(void)
Definition: xmlmemory.c:880
static xmlMutex xmlMemMutex
Definition: xmlmemory.c:38
static unsigned int block
Definition: xmlmemory.c:101
#define HDR_2_CLIENT(a)
Definition: xmlmemory.c:98
#define Mem_Tag_Err(a)
Definition: xmlmemory.c:113
#define MEMTAG
Definition: xmlmemory.c:64
#define TEST_POINT
Definition: xmlmemory.c:116
int xmlGcMemSetup(xmlFreeFunc freeFunc, xmlMallocFunc mallocFunc, xmlMallocFunc mallocAtomicFunc, xmlReallocFunc reallocFunc, xmlStrdupFunc strdupFunc)
Definition: xmlmemory.c:967
#define REALLOC_ATOMIC_TYPE
Definition: xmlmemory.c:70
void xmlMemDisplayLast(FILE *fp, long nbBytes)
Definition: xmlmemory.c:577
void xmlCleanupMemory(void)
Definition: xmlmemory.c:870
void * xmlMallocLoc(size_t size, const char *file, int line)
Definition: xmlmemory.c:145
static unsigned long debugMemBlocks
Definition: xmlmemory.c:36
static unsigned int xmlMemStopAtBlock
Definition: xmlmemory.c:102
static void debugmem_tag_error(void *addr)
Definition: xmlmemory.c:734
size_t xmlMemSize(void *ptr)
Definition: xmlmemory.c:522
#define RESERVE_SIZE
Definition: xmlmemory.c:92
char * xmlMemoryStrdup(const char *str)
Definition: xmlmemory.c:510
char * xmlMemStrdupLoc(const char *str, const char *file, int line)
Definition: xmlmemory.c:446
#define STRDUP_TYPE
Definition: xmlmemory.c:68
int xmlMemSetup(xmlFreeFunc freeFunc, xmlMallocFunc mallocFunc, xmlReallocFunc reallocFunc, xmlStrdupFunc strdupFunc)
Definition: xmlmemory.c:909
int xmlGcMemGet(xmlFreeFunc *freeFunc, xmlMallocFunc *mallocFunc, xmlMallocFunc *mallocAtomicFunc, xmlReallocFunc *reallocFunc, xmlStrdupFunc *strdupFunc)
Definition: xmlmemory.c:1003
struct memnod MEMHDR
int xmlMemGet(xmlFreeFunc *freeFunc, xmlMallocFunc *mallocFunc, xmlReallocFunc *reallocFunc, xmlStrdupFunc *strdupFunc)
Definition: xmlmemory.c:939
static unsigned long debugMemSize
Definition: xmlmemory.c:35
void xmlInitMemoryInternal(void)
Definition: xmlmemory.c:846
#define REALLOC_TYPE
Definition: xmlmemory.c:67
static void * xmlMemTraceBlockAt
Definition: xmlmemory.c:103
#define MAX_SIZE_T
Definition: xmlmemory.c:95
int xmlInitMemory(void)
Definition: xmlmemory.c:833
void xmlMemShow(FILE *fp, int nr ATTRIBUTE_UNUSED)
Definition: xmlmemory.c:758
void * xmlReallocLoc(void *ptr, size_t size, const char *file, int line)
Definition: xmlmemory.c:290
static unsigned long debugMaxMemSize
Definition: xmlmemory.c:37
void xmlMemDisplay(FILE *fp)
Definition: xmlmemory.c:644
void xmlMemoryDump(void)
Definition: xmlmemory.c:802
#define CLIENT_2_HDR(a)
Definition: xmlmemory.c:97
int xmlMemBlocks(void)
Definition: xmlmemory.c:557
void *(* xmlReallocFunc)(void *mem, size_t size)
Definition: xmlmemory.h:51
char *(* xmlStrdupFunc)(const char *str)
Definition: xmlmemory.h:61
void(* xmlFreeFunc)(void *mem)
Definition: xmlmemory.h:31