libxml2_xmlmemory.h File Reference

Typedef xmlFreeFunc

typedef void(XMLCALL *xmlFreeFunc

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. DEBUG_MEMORY_LOCATION:

DEBUG_MEMORY_LOCATION should be activated only when debugging libxml i.e. if libxml has been configured with --with-debug-mem too. xmlFreeFunc: Signature for a free() implementation.

Typedef xmlMallocFunc

typedef void *(XMLCALL *xmlMallocFunc

xmlMallocFunc: Signature for a malloc() implementation.

Returns a pointer to the newly allocated block or NULL in case of error.

Typedef xmlReallocFunc

typedef void *(XMLCALL *xmlReallocFunc

xmlReallocFunc: Signature for a realloc() implementation.

Returns a pointer to the newly reallocated block or NULL in case of error.

Typedef xmlStrdupFunc

typedef char *(XMLCALL *xmlStrdupFunc

xmlStrdupFunc: Signature for an strdup() implementation.

Returns the copy of the string or NULL in case of error.

xmlMemSetup ( xmlFreeFunc, xmlMallocFunc, xmlReallocFunc, xmlStrdupFunc )

XMLPUBFUN int XMLCALLxmlMemSetup(xmlFreeFuncfreeFunc,
xmlMallocFuncmallocFunc,
xmlReallocFuncreallocFunc,
xmlStrdupFuncstrdupFunc
)

xmlMemGet ( xmlFreeFunc *, xmlMallocFunc *, xmlReallocFunc *, xmlStrdupFunc * )

XMLPUBFUN int XMLCALLxmlMemGet(xmlFreeFunc *freeFunc,
xmlMallocFunc *mallocFunc,
xmlReallocFunc *reallocFunc,
xmlStrdupFunc *strdupFunc
)

xmlGcMemSetup ( xmlFreeFunc, xmlMallocFunc, xmlMallocFunc, xmlReallocFunc, xmlStrdupFunc )

XMLPUBFUN int XMLCALLxmlGcMemSetup(xmlFreeFuncfreeFunc,
xmlMallocFuncmallocFunc,
xmlMallocFuncmallocAtomicFunc,
xmlReallocFuncreallocFunc,
xmlStrdupFuncstrdupFunc
)

xmlGcMemGet ( xmlFreeFunc *, xmlMallocFunc *, xmlMallocFunc *, xmlReallocFunc *, xmlStrdupFunc * )

XMLPUBFUN int XMLCALLxmlGcMemGet(xmlFreeFunc *freeFunc,
xmlMallocFunc *mallocFunc,
xmlMallocFunc *mallocAtomicFunc,
xmlReallocFunc *reallocFunc,
xmlStrdupFunc *strdupFunc
)

xmlInitMemory ( void )

XMLPUBFUN int XMLCALLxmlInitMemory(void)

xmlInitMemory:

Initialize the memory layer.

Returns 0 on success

OOM: maybe possible -- during calls to standard library (???)

xmlCleanupMemory ( void )

XMLPUBFUN void XMLCALLxmlCleanupMemory(void)

xmlCleanupMemory:

Free up all the memory associated with memorys

OOM: never

xmlMemUsed ( void )

XMLPUBFUN int XMLCALLxmlMemUsed(void)

xmlMemUsed:

Provides the amount of memory currently allocated

Returns an int representing the amount of memory allocated.

xmlMemDisplay ( FILE * )

XMLPUBFUN void XMLCALLxmlMemDisplay(FILE *fp)

xmlMemDisplay: show in-extenso the memory blocks allocated

Parameters
fpa FILE descriptor used as the output file, if NULL, the result is written to the file .memorylist

xmlMemShow ( FILE *, int )

XMLPUBFUN void XMLCALLxmlMemShow(FILE *fp,
intnr
)

xmlMemShow: show a show display of the memory allocated, and dump the nr last allocated areas which were not freed

Parameters
fpa FILE descriptor used as the output file
nrnumber of entries to dump

xmlMemoryDump ( void )

XMLPUBFUN void XMLCALLxmlMemoryDump(void)

xmlMemoryDump:

Dump in-extenso the memory blocks allocated to the file .memorylist

xmlMemMalloc ( size_t )

XMLPUBFUN void *XMLCALLxmlMemMalloc(size_tsize)

xmlMemMalloc: a malloc() equivalent, with logging of the allocation info.

Returns a pointer to the allocated area or NULL in case of lack of memory.

Parameters
sizean int specifying the size in byte to allocate.

xmlMemRealloc ( void *, size_t )

XMLPUBFUN void *XMLCALLxmlMemRealloc(void *ptr,
size_tsize
)

xmlMemRealloc: a realloc() equivalent, with logging of the allocation info.

Returns a pointer to the allocated area or NULL in case of lack of memory.

Parameters
ptrthe initial memory block pointer
sizean int specifying the size in byte to allocate.

xmlMemFree ( void * )

XMLPUBFUN void XMLCALLxmlMemFree(void *ptr)

xmlMemFree: a free() equivalent, with error checking.

Parameters
ptrthe memory block pointer

xmlMemoryStrdup ( const char * )

XMLPUBFUN char *XMLCALLxmlMemoryStrdup(const char *str)

xmlMemoryStrdup: a strdup() equivalent, with logging of the allocation info.

Returns a pointer to the new string or NULL if allocation error occurred.

Parameters
strthe initial string pointer

xmlMallocLoc ( size_t, const char *, int )

XMLPUBFUN void *XMLCALLxmlMallocLoc(size_tsize,
const char *file,
intline
)

xmlMallocLoc: a malloc() equivalent, with logging of the allocation info.

Returns a pointer to the allocated area or NULL in case of lack of memory.

Parameters
sizean int specifying the size in byte to allocate.
filethe file name or NULL
linethe line number

xmlReallocLoc ( void *, size_t, const char *, int )

XMLPUBFUN void *XMLCALLxmlReallocLoc(void *ptr,
size_tsize,
const char *file,
intline
)

xmlReallocLoc: a realloc() equivalent, with logging of the allocation info.

Returns a pointer to the allocated area or NULL in case of lack of memory.

Parameters
ptrthe initial memory block pointer
sizean int specifying the size in byte to allocate.
filethe file name or NULL
linethe line number

xmlMallocAtomicLoc ( size_t, const char *, int )

XMLPUBFUN void *XMLCALLxmlMallocAtomicLoc(size_tsize,
const char *file,
intline
)

xmlMallocAtomicLoc: a malloc() equivalent, with logging of the allocation info.

Returns a pointer to the allocated area or NULL in case of lack of memory.

Parameters
sizean int specifying the size in byte to allocate.
filethe file name or NULL
linethe line number

xmlMemStrdupLoc ( const char *, const char *, int )

XMLPUBFUN char *XMLCALLxmlMemStrdupLoc(const char *str,
const char *file,
intline
)

xmlMemStrdupLoc: a strdup() equivalent, with logging of the allocation info.

Returns a pointer to the new string or NULL if allocation error occurred.

Parameters
strthe initial string pointer
filethe file name or NULL
linethe line number