libxml2
|
interface for the memory allocator More...
Typedefs | |
typedef void(* | xmlFreeFunc) (void *mem) |
Signature for a free() implementation. | |
typedef void *(* | xmlMallocFunc) (size_t size) |
Signature for a malloc() implementation. | |
typedef void *(* | xmlReallocFunc) (void *mem, size_t size) |
Signature for a realloc() implementation. | |
typedef char *(* | xmlStrdupFunc) (const char *str) |
Signature for an strdup() implementation. |
Functions | |
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 ! | |
int | xmlMemGet (xmlFreeFunc *freeFunc, xmlMallocFunc *mallocFunc, xmlReallocFunc *reallocFunc, xmlStrdupFunc *strdupFunc) |
Provides the memory access functions set currently in use. | |
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 ! | |
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. | |
int | xmlInitMemory (void) |
void | xmlCleanupMemory (void) |
size_t | xmlMemSize (void *ptr) |
int | xmlMemUsed (void) |
Provides the amount of memory currently allocated. | |
int | xmlMemBlocks (void) |
Provides the number of memory areas currently allocated. | |
void | xmlMemDisplay (FILE *fp) |
void | xmlMemDisplayLast (FILE *fp, long nbBytes) |
void | xmlMemShow (FILE *fp, int nr) |
void | xmlMemoryDump (void) |
void * | xmlMemMalloc (size_t size) |
a malloc() equivalent, with logging of the allocation info. | |
void * | xmlMemRealloc (void *ptr, size_t size) |
a realloc() equivalent, with logging of the allocation info. | |
void | xmlMemFree (void *ptr) |
a free() equivalent, with error checking. | |
char * | xmlMemoryStrdup (const char *str) |
a strdup() equivalent, with logging of the allocation info. | |
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) |
Variables | |
xmlMallocFunc | xmlMalloc |
The variable holding the libxml malloc() implementation. | |
xmlMallocFunc | xmlMallocAtomic |
The variable holding the libxml malloc() implementation for atomic data (i.e. | |
xmlReallocFunc | xmlRealloc |
The variable holding the libxml realloc() implementation. | |
xmlFreeFunc | xmlFree |
The variable holding the libxml free() implementation. | |
xmlStrdupFunc | xmlMemStrdup |
The variable holding the libxml strdup() implementation. |
interface for the memory allocator
provides interfaces for the memory allocator, including debugging capabilities.
typedef void(* xmlFreeFunc) (void *mem) |
Signature for a free() implementation.
mem | an already allocated block of memory |
typedef void *(* xmlMallocFunc) (size_t size) |
Signature for a malloc() implementation.
size | the size requested in bytes |
typedef void *(* xmlReallocFunc) (void *mem, size_t size) |
Signature for a realloc() implementation.
mem | an already allocated block of memory |
size | the new size requested in bytes |
typedef char *(* xmlStrdupFunc) (const char *str) |
Signature for an strdup() implementation.
str | a zero terminated string |
void xmlCleanupMemory | ( | void | ) |
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 free() function in use |
mallocFunc | place to save the malloc() function in use |
mallocAtomicFunc | place to save the atomic malloc() function in use |
reallocFunc | place to save the realloc() function in use |
strdupFunc | place to save the strdup() function in use |
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 free() function to use |
mallocFunc | the malloc() function to use |
mallocAtomicFunc | the malloc() function to use for atomic allocations |
reallocFunc | the realloc() function to use |
strdupFunc | the strdup() function to use |
int xmlInitMemory | ( | void | ) |
void * xmlMallocAtomicLoc | ( | size_t | size, |
const char * | file, | ||
int | line ) |
size | an unsigned int specifying the size in byte to allocate. |
file | the file name or NULL |
line | the line number |
void * xmlMallocLoc | ( | size_t | size, |
const char * | file, | ||
int | line ) |
size | an int specifying the size in byte to allocate. |
file | the file name or NULL |
line | the line number |
int xmlMemBlocks | ( | void | ) |
Provides the number of memory areas currently allocated.
void xmlMemDisplay | ( | FILE * | fp | ) |
fp | a FILE descriptor |
void xmlMemDisplayLast | ( | FILE * | fp, |
long | nbBytes ) |
fp | a FILE descriptor |
nbBytes | the amount of memory to dump |
void xmlMemFree | ( | void * | ptr | ) |
a free() equivalent, with error checking.
ptr | the memory block pointer |
int xmlMemGet | ( | xmlFreeFunc * | freeFunc, |
xmlMallocFunc * | mallocFunc, | ||
xmlReallocFunc * | reallocFunc, | ||
xmlStrdupFunc * | strdupFunc ) |
Provides the memory access functions set currently in use.
freeFunc | place to save the free() function in use |
mallocFunc | place to save the malloc() function in use |
reallocFunc | place to save the realloc() function in use |
strdupFunc | place to save the strdup() function in use |
void * xmlMemMalloc | ( | size_t | size | ) |
a malloc() equivalent, with logging of the allocation info.
size | an int specifying the size in byte to allocate. |
void xmlMemoryDump | ( | void | ) |
char * xmlMemoryStrdup | ( | const char * | str | ) |
a strdup() equivalent, with logging of the allocation info.
str | the initial string pointer |
void * xmlMemRealloc | ( | void * | ptr, |
size_t | size ) |
a realloc() equivalent, with logging of the allocation info.
ptr | the initial memory block pointer |
size | an int specifying the size in byte to allocate. |
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 free() function to use |
mallocFunc | the malloc() function to use |
reallocFunc | the realloc() function to use |
strdupFunc | the strdup() function to use |
void xmlMemShow | ( | FILE * | fp, |
int | nr ) |
fp | a FILE descriptor |
nr | number of entries to dump |
size_t xmlMemSize | ( | void * | ptr | ) |
ptr | pointer to the memory allocation |
char * xmlMemStrdupLoc | ( | const char * | str, |
const char * | file, | ||
int | line ) |
str | the initial string pointer |
file | the file name or NULL |
line | the line number |
int xmlMemUsed | ( | void | ) |
Provides the amount of memory currently allocated.
void * xmlReallocLoc | ( | void * | ptr, |
size_t | size, | ||
const char * | file, | ||
int | line ) |
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 |
|
extern |
The variable holding the libxml malloc() implementation for atomic data (i.e.
blocks not containing pointers), useful when using a garbage collecting allocator.