File indexing completed on 2026-09-26 09:00:46
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef __DEBUG_MEMORY_ALLOC__
0016 #define __DEBUG_MEMORY_ALLOC__
0017
0018 #include <stdio.h>
0019 #include <libxml/xmlversion.h>
0020
0021 #ifdef __cplusplus
0022 extern "C" {
0023 #endif
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033 typedef void (*xmlFreeFunc)(void *mem);
0034
0035
0036
0037
0038
0039
0040 typedef void *(*xmlMallocFunc)(size_t size) LIBXML_ATTR_ALLOC_SIZE(1);
0041
0042
0043
0044
0045
0046
0047
0048
0049 typedef void *(*xmlReallocFunc)(void *mem, size_t size);
0050
0051
0052
0053
0054
0055
0056
0057 typedef char *(*xmlStrdupFunc)(const char *str);
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068 #ifdef LIBXML_THREAD_ALLOC_ENABLED
0069
0070 XMLPUBFUN xmlMallocFunc *__xmlMalloc(void);
0071 XMLPUBFUN xmlMallocFunc *__xmlMallocAtomic(void);
0072 XMLPUBFUN xmlReallocFunc *__xmlRealloc(void);
0073 XMLPUBFUN xmlFreeFunc *__xmlFree(void);
0074 XMLPUBFUN xmlStrdupFunc *__xmlMemStrdup(void);
0075
0076 #ifndef XML_GLOBALS_NO_REDEFINITION
0077 #define xmlMalloc (*__xmlMalloc())
0078 #define xmlMallocAtomic (*__xmlMallocAtomic())
0079 #define xmlRealloc (*__xmlRealloc())
0080 #define xmlFree (*__xmlFree())
0081 #define xmlMemStrdup (*__xmlMemStrdup())
0082 #endif
0083
0084 #else
0085
0086
0087
0088
0089 XMLPUBVAR xmlMallocFunc xmlMalloc;
0090
0091
0092
0093
0094
0095
0096
0097 XMLPUBVAR xmlMallocFunc xmlMallocAtomic;
0098
0099
0100
0101 XMLPUBVAR xmlReallocFunc xmlRealloc;
0102
0103
0104
0105 XMLPUBVAR xmlFreeFunc xmlFree;
0106
0107
0108
0109 XMLPUBVAR xmlStrdupFunc xmlMemStrdup;
0110
0111 #endif
0112
0113
0114
0115
0116
0117
0118 XMLPUBFUN int
0119 xmlMemSetup (xmlFreeFunc freeFunc,
0120 xmlMallocFunc mallocFunc,
0121 xmlReallocFunc reallocFunc,
0122 xmlStrdupFunc strdupFunc);
0123 XMLPUBFUN int
0124 xmlMemGet (xmlFreeFunc *freeFunc,
0125 xmlMallocFunc *mallocFunc,
0126 xmlReallocFunc *reallocFunc,
0127 xmlStrdupFunc *strdupFunc);
0128 XML_DEPRECATED
0129 XMLPUBFUN int
0130 xmlGcMemSetup (xmlFreeFunc freeFunc,
0131 xmlMallocFunc mallocFunc,
0132 xmlMallocFunc mallocAtomicFunc,
0133 xmlReallocFunc reallocFunc,
0134 xmlStrdupFunc strdupFunc);
0135 XML_DEPRECATED
0136 XMLPUBFUN int
0137 xmlGcMemGet (xmlFreeFunc *freeFunc,
0138 xmlMallocFunc *mallocFunc,
0139 xmlMallocFunc *mallocAtomicFunc,
0140 xmlReallocFunc *reallocFunc,
0141 xmlStrdupFunc *strdupFunc);
0142
0143
0144
0145
0146 XML_DEPRECATED
0147 XMLPUBFUN int
0148 xmlInitMemory (void);
0149
0150
0151
0152
0153 XML_DEPRECATED
0154 XMLPUBFUN void
0155 xmlCleanupMemory (void);
0156
0157
0158
0159 XMLPUBFUN size_t
0160 xmlMemSize (void *ptr);
0161 XMLPUBFUN int
0162 xmlMemUsed (void);
0163 XMLPUBFUN int
0164 xmlMemBlocks (void);
0165 XML_DEPRECATED
0166 XMLPUBFUN void
0167 xmlMemDisplay (FILE *fp);
0168 XML_DEPRECATED
0169 XMLPUBFUN void
0170 xmlMemDisplayLast(FILE *fp, long nbBytes);
0171 XML_DEPRECATED
0172 XMLPUBFUN void
0173 xmlMemShow (FILE *fp, int nr);
0174 XML_DEPRECATED
0175 XMLPUBFUN void
0176 xmlMemoryDump (void);
0177 XMLPUBFUN void *
0178 xmlMemMalloc (size_t size) LIBXML_ATTR_ALLOC_SIZE(1);
0179 XMLPUBFUN void *
0180 xmlMemRealloc (void *ptr,size_t size);
0181 XMLPUBFUN void
0182 xmlMemFree (void *ptr);
0183 XMLPUBFUN char *
0184 xmlMemoryStrdup (const char *str);
0185 XML_DEPRECATED
0186 XMLPUBFUN void *
0187 xmlMallocLoc (size_t size, const char *file, int line) LIBXML_ATTR_ALLOC_SIZE(1);
0188 XML_DEPRECATED
0189 XMLPUBFUN void *
0190 xmlReallocLoc (void *ptr, size_t size, const char *file, int line);
0191 XML_DEPRECATED
0192 XMLPUBFUN void *
0193 xmlMallocAtomicLoc (size_t size, const char *file, int line) LIBXML_ATTR_ALLOC_SIZE(1);
0194 XML_DEPRECATED
0195 XMLPUBFUN char *
0196 xmlMemStrdupLoc (const char *str, const char *file, int line);
0197
0198 #ifdef __cplusplus
0199 }
0200 #endif
0201
0202 #endif
0203