|  |  |  | Gnome XML Library Reference Manual |  | 
|---|
xmlmemory —
#define DEBUG_MEMORY void (*xmlFreeFunc) (void *mem); void* (*xmlMallocFunc) (size_t size); void* (*xmlReallocFunc) (void *mem,size_t size); char* (*xmlStrdupFunc) (const char *str); int xmlMemSetup (xmlFreeFunc freeFunc, xmlMallocFunc mallocFunc, xmlReallocFunc reallocFunc, xmlStrdupFunc strdupFunc); int xmlMemGet (xmlFreeFunc *freeFunc, xmlMallocFunc *mallocFunc, xmlReallocFunc *reallocFunc, xmlStrdupFunc *strdupFunc); int xmlGcMemSetup (xmlFreeFunc freeFunc, xmlMallocFunc mallocFunc, xmlMallocFunc mallocAtomicFunc, xmlReallocFunc reallocFunc, xmlStrdupFunc strdupFunc); int xmlGcMemGet (xmlFreeFunc *freeFunc, xmlMallocFunc *mallocFunc, xmlMallocFunc *mallocAtomicFunc, xmlReallocFunc *reallocFunc, xmlStrdupFunc *strdupFunc); int xmlInitMemory (void); int xmlMemUsed (void); void xmlMemDisplay (FILE *fp); void xmlMemShow (FILE *fp, int nr); void xmlMemoryDump (void); void* xmlMemMalloc (size_t size); void* xmlMemRealloc (void *ptr,size_t size); void xmlMemFree (void *ptr); char* xmlMemoryStrdup (const char *str); void* xmlMallocLoc (size_t size, const char *file, int line); void* xmlReallocLoc (void *ptr,size_t size, const char *file, int line); void* xmlMallocAtomicLoc (size_t size, const char *file, int line); char* xmlMemStrdupLoc (const char *str, const char *file, int line); #define xmlMalloc (size) #define xmlMallocAtomic (size) #define xmlRealloc (ptr, size) #define xmlMemStrdup (str)
#define DEBUG_MEMORY
DEBUG_MEMORY replaces the allocator with a collect and debug shell to the libc allocator. DEBUG_MEMORY should only be activated when debugging libxml i.e. if libxml has been configured with --with-debug-mem too.
void (*xmlFreeFunc) (void *mem);
Signature for a 
| mem : | an already allocated block of memory | 
void* (*xmlMallocFunc) (size_t size);
Signature for a 
| size : | the size requested in bytes | 
void*       (*xmlReallocFunc)               (void *mem,
                                             size_t  size);
Signature for a 
| mem : | an already allocated block of memory | 
| size : | the new size requested in bytes | 
char* (*xmlStrdupFunc) (const char *str);
Signature for an 
| str : | a zero terminated string | 
| Returns : | the copy of the string or NULL in case of error. | 
int xmlMemSetup (xmlFreeFunc freeFunc, xmlMallocFunc mallocFunc, xmlReallocFunc reallocFunc, xmlStrdupFunc strdupFunc);
Override the default memory access functions with a new set This has to be called before any other libxml routines !
Should this be blocked if there was already some allocations done ?
| freeFunc : | the | 
| mallocFunc : | the | 
| reallocFunc : | the | 
| strdupFunc : | the | 
| Returns : | 0 on success | 
int xmlMemGet (xmlFreeFunc *freeFunc, xmlMallocFunc *mallocFunc, xmlReallocFunc *reallocFunc, xmlStrdupFunc *strdupFunc);
Provides the memory access functions set currently in use
| freeFunc : | place to save the | 
| mallocFunc : | place to save the | 
| reallocFunc : | place to save the | 
| strdupFunc : | place to save the | 
| Returns : | 0 on success | 
int xmlGcMemSetup (xmlFreeFunc freeFunc, xmlMallocFunc mallocFunc, xmlMallocFunc mallocAtomicFunc, xmlReallocFunc reallocFunc, xmlStrdupFunc strdupFunc);
Override the default memory access functions with a new set This has to be called before any other libxml routines ! The mallocAtomicFunc is specialized for atomic block allocations (i.e. of areas useful for garbage collected memory allocators
Should this be blocked if there was already some allocations done ?
| freeFunc : | the | 
| mallocFunc : | the | 
| mallocAtomicFunc : | the | 
| reallocFunc : | the | 
| strdupFunc : | the | 
| Returns : | 0 on success | 
int xmlGcMemGet (xmlFreeFunc *freeFunc, xmlMallocFunc *mallocFunc, xmlMallocFunc *mallocAtomicFunc, xmlReallocFunc *reallocFunc, xmlStrdupFunc *strdupFunc);
Provides the memory access functions set currently in use The mallocAtomicFunc is specialized for atomic block allocations (i.e. of areas useful for garbage collected memory allocators
| freeFunc : | place to save the | 
| mallocFunc : | place to save the | 
| mallocAtomicFunc : | place to save the atomic | 
| reallocFunc : | place to save the | 
| strdupFunc : | place to save the | 
| Returns : | 0 on success | 
int xmlMemUsed (void);
Provides the amount of memory currently allocated
| Returns : | an int representing the amount of memory allocated. | 
void xmlMemDisplay (FILE *fp);
show in-extenso the memory blocks allocated
| fp : | a FILE descriptor used as the output file, if NULL, the result is written to the file .memorylist | 
void xmlMemShow (FILE *fp, int nr);
show a show display of the memory allocated, and dump the nr last allocated areas which were not freed
| fp : | a FILE descriptor used as the output file | 
| nr : | number of entries to dump | 
void xmlMemoryDump (void);
Dump in-extenso the memory blocks allocated to the file .memorylist
void* xmlMemMalloc (size_t size);
a 
| size : | an int specifying the size in byte to allocate. | 
void*       xmlMemRealloc                   (void *ptr,
                                             size_t  size);
a 
| ptr : | the initial memory block pointer | 
| size : | an int specifying the size in byte to allocate. | 
void xmlMemFree (void *ptr);
a 
| ptr : | the memory block pointer | 
char* xmlMemoryStrdup (const char *str);
a 
| str : | the initial string pointer | 
| Returns : | a pointer to the new string or NULL if allocation error occurred. | 
void* xmlMallocLoc (size_t size, const char *file, int line);
a 
| size : | an int specifying the size in byte to allocate. | 
| file : | the file name or NULL | 
| line : | the line number | 
void*       xmlReallocLoc                   (void *ptr,
                                             size_t  size,
                                             const char *file,
                                             int line);
a 
| ptr : | the initial memory block pointer | 
| size : | an int specifying the size in byte to allocate. | 
| file : | the file name or NULL | 
| line : | the line number | 
void* xmlMallocAtomicLoc (size_t size, const char *file, int line);
a 
| size : | an int specifying the size in byte to allocate. | 
| file : | the file name or NULL | 
| line : | the line number | 
char*       xmlMemStrdupLoc                 (const char *str,
                                             const char *file,
                                             int line);
a 
| str : | the initial string pointer | 
| file : | the file name or NULL | 
| line : | the line number | 
| Returns : | a pointer to the new string or NULL if allocation error occurred. | 
#define xmlMalloc(size)
Wrapper for the 
| size : | number of bytes to allocate | 
#define xmlMallocAtomic(size)
Wrapper for the 
| size : | number of bytes to allocate | 
#define xmlRealloc(ptr, size)
Wrapper for the 
| ptr : | pointer to the existing allocated area | 
| size : | number of bytes to allocate | 
#define xmlMemStrdup(str)
Wrapper for the 
| str : | pointer to the existing string | 
| << debugXML | xmlregexp >> |