Blame doc/html/libxml-xmlmemory.html

Packit Service a31ea6
Packit Service a31ea6
Packit Service a31ea6
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><link rel="SHORTCUT ICON" href="/favicon.ico" /><style type="text/css">
Packit Service a31ea6
TD {font-family: Verdana,Arial,Helvetica}
Packit Service a31ea6
BODY {font-family: Verdana,Arial,Helvetica; margin-top: 2em; margin-left: 0em; margin-right: 0em}
Packit Service a31ea6
H1 {font-family: Verdana,Arial,Helvetica}
Packit Service a31ea6
H2 {font-family: Verdana,Arial,Helvetica}
Packit Service a31ea6
H3 {font-family: Verdana,Arial,Helvetica}
Packit Service a31ea6
A:link, A:visited, A:active { text-decoration: underline }
Packit Service a31ea6
</style><style type="text/css">
Packit Service a31ea6
      div.deprecated pre.programlisting {border-style: double;border-color:red}
Packit Service a31ea6
      pre.programlisting {border-style: double;background: #EECFA1}
Packit Service a31ea6
    </style><title>Module xmlmemory from libxml2</title></head><body bgcolor="#8b7765" text="#000000" link="#a06060" vlink="#000000">
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module xmlmemory from libxml2

<center>API Menu</center>
<form action="../search.php" enctype="application/x-www-form-urlencoded" method="get"><input name="query" type="text" size="20" value="" /><input name="submit" type="submit" value="Search ..." /></form>
<center>API Indexes</center>
<center>Related links</center>

provides interfaces for the memory allocator, including debugging capabilities.

Table of Contents

#define DEBUG_MEMORY
Variable xmlMallocFunc xmlMalloc
Packit Service a31ea6
Packit Service a31ea6
Variable xmlMallocFunc xmlMallocAtomic
Packit Service a31ea6
Packit Service a31ea6
Variable xmlStrdupFunc xmlMemStrdup
Packit Service a31ea6
Packit Service a31ea6
Variable xmlReallocFunc xmlRealloc
Packit Service a31ea6
Packit Service a31ea6
void	xmlCleanupMemory		(void)
Packit Service a31ea6
Function type: xmlFreeFunc
Packit Service a31ea6
void	xmlFreeFunc			(void * mem)
Packit Service a31ea6
Packit Service a31ea6
int	xmlGcMemGet			(xmlFreeFunc * freeFunc, 
xmlMallocFunc * mallocFunc,
xmlMallocFunc * mallocAtomicFunc,
xmlReallocFunc * reallocFunc,
xmlStrdupFunc * strdupFunc)
Packit Service a31ea6
int	xmlGcMemSetup			(xmlFreeFunc freeFunc, 
xmlMallocFunc mallocFunc,
xmlMallocFunc mallocAtomicFunc,
xmlReallocFunc reallocFunc,
xmlStrdupFunc strdupFunc)
Packit Service a31ea6
int	xmlInitMemory			(void)
Packit Service a31ea6
void *	xmlMallocAtomicLoc		(size_t size, 
const char * file,
int line)
Packit Service a31ea6
Function type: xmlMallocFunc
Packit Service a31ea6
void *	xmlMallocFunc			(size_t size)
Packit Service a31ea6
Packit Service a31ea6
void *	xmlMallocLoc			(size_t size, 
const char * file,
int line)
Packit Service a31ea6
int	xmlMemBlocks			(void)
Packit Service a31ea6
void	xmlMemDisplay			(FILE * fp)
Packit Service a31ea6
void	xmlMemDisplayLast		(FILE * fp, 
long nbBytes)
Packit Service a31ea6
void	xmlMemFree			(void * ptr)
Packit Service a31ea6
int	xmlMemGet			(xmlFreeFunc * freeFunc, 
xmlMallocFunc * mallocFunc,
xmlReallocFunc * reallocFunc,
xmlStrdupFunc * strdupFunc)
Packit Service a31ea6
void *	xmlMemMalloc			(size_t size)
Packit Service a31ea6
void *	xmlMemRealloc			(void * ptr, 
size_t size)
Packit Service a31ea6
int	xmlMemSetup			(xmlFreeFunc freeFunc, 
xmlMallocFunc mallocFunc,
xmlReallocFunc reallocFunc,
xmlStrdupFunc strdupFunc)
Packit Service a31ea6
void	xmlMemShow			(FILE * fp, 
int nr)
Packit Service a31ea6
char *	xmlMemStrdupLoc			(const char * str, 
const char * file,
int line)
Packit Service a31ea6
int	xmlMemUsed			(void)
Packit Service a31ea6
void	xmlMemoryDump			(void)
Packit Service a31ea6
char *	xmlMemoryStrdup			(const char * str)
Packit Service a31ea6
Function type: xmlReallocFunc
Packit Service a31ea6
void *	xmlReallocFunc			(void * mem, 
size_t size)
Packit Service a31ea6
Packit Service a31ea6
void *	xmlReallocLoc			(void * ptr, 
size_t size,
const char * file,
int line)
Packit Service a31ea6
Function type: xmlStrdupFunc
Packit Service a31ea6
char *	xmlStrdupFunc			(const char * str)
Packit Service a31ea6
Packit Service a31ea6

Description

Packit Service a31ea6

Macro: DEBUG_MEMORY

#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. #define DEBUG_MEMORY_FREED #define DEBUG_MEMORY_LOCATION

Packit Service a31ea6

Function: xmlCleanupMemory

void	xmlCleanupMemory		(void)
Packit Service a31ea6

Free up all the memory allocated by the library for its own use. This should not be called by user level code.

Packit Service a31ea6

Function type: xmlFreeFunc

Function type: xmlFreeFunc
Packit Service a31ea6
void	xmlFreeFunc			(void * mem)
Packit Service a31ea6

Signature for a free() implementation.

<tt>mem</tt>:an already allocated block of memory

Packit Service a31ea6

Function: xmlGcMemGet

int	xmlGcMemGet			(xmlFreeFunc * freeFunc, 
xmlMallocFunc * mallocFunc,
xmlMallocFunc * mallocAtomicFunc,
xmlReallocFunc * reallocFunc,
xmlStrdupFunc * strdupFunc)
Packit Service a31ea6

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

Packit Service a31ea6
<tt>freeFunc</tt>:place to save the free() function in use
<tt>mallocFunc</tt>:place to save the malloc() function in use
<tt>mallocAtomicFunc</tt>:place to save the atomic malloc() function in use
<tt>reallocFunc</tt>:place to save the realloc() function in use
<tt>strdupFunc</tt>:place to save the strdup() function in use
<tt>Returns</tt>:0 on success

Function: xmlGcMemSetup

int	xmlGcMemSetup			(xmlFreeFunc freeFunc, 
xmlMallocFunc mallocFunc,
xmlMallocFunc mallocAtomicFunc,
xmlReallocFunc reallocFunc,
xmlStrdupFunc strdupFunc)
Packit Service a31ea6

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 ?

Packit Service a31ea6
<tt>freeFunc</tt>:the free() function to use
<tt>mallocFunc</tt>:the malloc() function to use
<tt>mallocAtomicFunc</tt>:the malloc() function to use for atomic allocations
<tt>reallocFunc</tt>:the realloc() function to use
<tt>strdupFunc</tt>:the strdup() function to use
<tt>Returns</tt>:0 on success

Function: xmlInitMemory

int	xmlInitMemory			(void)
Packit Service a31ea6

Initialize the memory layer.

Packit Service a31ea6
<tt>Returns</tt>:0 on success

Function: xmlMallocAtomicLoc

void *	xmlMallocAtomicLoc		(size_t size, 
const char * file,
int line)
Packit Service a31ea6

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

Packit Service a31ea6
<tt>size</tt>:an unsigned int specifying the size in byte to allocate.
<tt>file</tt>:the file name or NULL
<tt>line</tt>:the line number
<tt>Returns</tt>:a pointer to the allocated area or NULL in case of lack of memory.

Function type: xmlMallocFunc

Function type: xmlMallocFunc
Packit Service a31ea6
void *	xmlMallocFunc			(size_t size)
Packit Service a31ea6

Signature for a malloc() implementation.

<tt>size</tt>:the size requested in bytes
<tt>Returns</tt>:a pointer to the newly allocated block or NULL in case of error.

Packit Service a31ea6

Function: xmlMallocLoc

void *	xmlMallocLoc			(size_t size, 
const char * file,
int line)
Packit Service a31ea6

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

Packit Service a31ea6
<tt>size</tt>:an int specifying the size in byte to allocate.
<tt>file</tt>:the file name or NULL
<tt>line</tt>:the line number
<tt>Returns</tt>:a pointer to the allocated area or NULL in case of lack of memory.

Function: xmlMemBlocks

int	xmlMemBlocks			(void)
Packit Service a31ea6

Provides the number of memory areas currently allocated

Packit Service a31ea6
<tt>Returns</tt>:an int representing the number of blocks

Function: xmlMemDisplay

void	xmlMemDisplay			(FILE * fp)
Packit Service a31ea6

show in-extenso the memory blocks allocated

Packit Service a31ea6
<tt>fp</tt>:a FILE descriptor used as the output file, if NULL, the result is written to the file .memorylist

Function: xmlMemDisplayLast

void	xmlMemDisplayLast		(FILE * fp, 
long nbBytes)
Packit Service a31ea6

the last nbBytes of memory allocated and not freed, useful for dumping the memory left allocated between two places at runtime.

Packit Service a31ea6
<tt>fp</tt>:a FILE descriptor used as the output file, if NULL, the result is written to the file .memorylist
<tt>nbBytes</tt>:the amount of memory to dump

Function: xmlMemFree

void	xmlMemFree			(void * ptr)
Packit Service a31ea6

a free() equivalent, with error checking.

Packit Service a31ea6
<tt>ptr</tt>:the memory block pointer

Function: xmlMemGet

int	xmlMemGet			(xmlFreeFunc * freeFunc, 
xmlMallocFunc * mallocFunc,
xmlReallocFunc * reallocFunc,
xmlStrdupFunc * strdupFunc)
Packit Service a31ea6

Provides the memory access functions set currently in use

Packit Service a31ea6
<tt>freeFunc</tt>:place to save the free() function in use
<tt>mallocFunc</tt>:place to save the malloc() function in use
<tt>reallocFunc</tt>:place to save the realloc() function in use
<tt>strdupFunc</tt>:place to save the strdup() function in use
<tt>Returns</tt>:0 on success

Function: xmlMemMalloc

void *	xmlMemMalloc			(size_t size)
Packit Service a31ea6

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

Packit Service a31ea6
<tt>size</tt>:an int specifying the size in byte to allocate.
<tt>Returns</tt>:a pointer to the allocated area or NULL in case of lack of memory.

Function: xmlMemRealloc

void *	xmlMemRealloc			(void * ptr, 
size_t size)
Packit Service a31ea6

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

Packit Service a31ea6
<tt>ptr</tt>:the initial memory block pointer
<tt>size</tt>:an int specifying the size in byte to allocate.
<tt>Returns</tt>:a pointer to the allocated area or NULL in case of lack of memory.

Function: xmlMemSetup

int	xmlMemSetup			(xmlFreeFunc freeFunc, 
xmlMallocFunc mallocFunc,
xmlReallocFunc reallocFunc,
xmlStrdupFunc strdupFunc)
Packit Service a31ea6

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 ?

Packit Service a31ea6
<tt>freeFunc</tt>:the free() function to use
<tt>mallocFunc</tt>:the malloc() function to use
<tt>reallocFunc</tt>:the realloc() function to use
<tt>strdupFunc</tt>:the strdup() function to use
<tt>Returns</tt>:0 on success

Function: xmlMemShow

void	xmlMemShow			(FILE * fp, 
int nr)
Packit Service a31ea6

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

Packit Service a31ea6
<tt>fp</tt>:a FILE descriptor used as the output file
<tt>nr</tt>:number of entries to dump

Function: xmlMemStrdupLoc

char *	xmlMemStrdupLoc			(const char * str, 
const char * file,
int line)
Packit Service a31ea6

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

Packit Service a31ea6
<tt>str</tt>:the initial string pointer
<tt>file</tt>:the file name or NULL
<tt>line</tt>:the line number
<tt>Returns</tt>:a pointer to the new string or NULL if allocation error occurred.

Function: xmlMemUsed

int	xmlMemUsed			(void)
Packit Service a31ea6

Provides the amount of memory currently allocated

Packit Service a31ea6
<tt>Returns</tt>:an int representing the amount of memory allocated.

Function: xmlMemoryDump

void	xmlMemoryDump			(void)
Packit Service a31ea6

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

Packit Service a31ea6

Function: xmlMemoryStrdup

char *	xmlMemoryStrdup			(const char * str)
Packit Service a31ea6

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

Packit Service a31ea6
<tt>str</tt>:the initial string pointer
<tt>Returns</tt>:a pointer to the new string or NULL if allocation error occurred.

Function type: xmlReallocFunc

Function type: xmlReallocFunc
Packit Service a31ea6
void *	xmlReallocFunc			(void * mem, 
size_t size)
Packit Service a31ea6

Signature for a realloc() implementation.

<tt>mem</tt>:an already allocated block of memory
<tt>size</tt>:the new size requested in bytes
<tt>Returns</tt>:a pointer to the newly reallocated block or NULL in case of error.

Packit Service a31ea6

Function: xmlReallocLoc

void *	xmlReallocLoc			(void * ptr, 
size_t size,
const char * file,
int line)
Packit Service a31ea6

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

Packit Service a31ea6
<tt>ptr</tt>:the initial memory block pointer
<tt>size</tt>:an int specifying the size in byte to allocate.
<tt>file</tt>:the file name or NULL
<tt>line</tt>:the line number
<tt>Returns</tt>:a pointer to the allocated area or NULL in case of lack of memory.

Function type: xmlStrdupFunc

Function type: xmlStrdupFunc
Packit Service a31ea6
char *	xmlStrdupFunc			(const char * str)
Packit Service a31ea6

Signature for an strdup() implementation.

<tt>str</tt>:a zero terminated string
<tt>Returns</tt>:the copy of the string or NULL in case of error.

Packit Service a31ea6

Daniel Veillard

</body></html>