Gnome XML Library Reference Manual
<<< Previous Page | Home | Up | Next Page >>>

# xmlmemory

## Name

xmlmemory --

## Synopsis

    #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         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);
    #define     xmlMalloc                       (size)
    #define     xmlRealloc                      (ptr, size)
    #define     xmlMemStrdup                    (str)
    void*       xmlMallocLoc                    (size_t size,
                                                 const char *file,
                                                 int line);
    void*       xmlReallocLoc                   (void *ptr,
                                                 size_t size,
                                                 const char *file,
                                                 int line);
    char*       xmlMemStrdupLoc                 (const char *str,
                                                 const char *file,
                                                 int line);

## Description

## Details

### 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.

### xmlFreeFunc ()

    void        (*xmlFreeFunc)                  (void *mem);

Signature for a free() implementation.

`mem` : |

### xmlMallocFunc ()

    void*       (*xmlMallocFunc)                (size_t size);

Signature for a malloc() implementation.

`size` : |

### xmlReallocFunc ()

    void*       (*xmlReallocFunc)               (void *mem,
                                                 size_t size);

Signature for a realloc() implementation.

`mem` : |
`size` : |

### xmlStrdupFunc ()

    char*       (*xmlStrdupFunc)                (const char *str);

Signature for an strdup() implementation.

`str` : |
Returns : |

### xmlMemSetup ()

    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` : |
`mallocFunc` : |
`reallocFunc` : |
`strdupFunc` : |
Returns : |

### xmlMemGet ()

    int         xmlMemGet                       (xmlFreeFunc *freeFunc,
                                                 xmlMallocFunc *mallocFunc,
                                                 xmlReallocFunc *reallocFunc,
                                                 xmlStrdupFunc *strdupFunc);

Provides the memory access functions set currently in use

`freeFunc` : |
`mallocFunc` : |
`reallocFunc` : |
`strdupFunc` : |
Returns : |

### xmlInitMemory ()

    int         xmlInitMemory                   (void);

Initialize the memory layer.

Returns : |

### xmlMemUsed ()

    int         xmlMemUsed                      (void);

Provides the amount of memory currently allocated

Returns : |

### xmlMemDisplay ()

    void        xmlMemDisplay                   (FILE *fp);

show in-extenso the memory blocks allocated

`fp` : |

### xmlMemShow ()

    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` : |
`nr` : |

### xmlMemoryDump ()

    void        xmlMemoryDump                   (void);

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

### xmlMemMalloc ()

    void*       xmlMemMalloc                    (size_t size);

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

`size` : |

### xmlMemRealloc ()

    void*       xmlMemRealloc                   (void *ptr,
                                                 size_t size);

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

`ptr` : |
`size` : |

### xmlMemFree ()

    void        xmlMemFree                      (void *ptr);

a free() equivalent, with error checking.

`ptr` : |

### xmlMemoryStrdup ()

    char*       xmlMemoryStrdup                 (const char *str);

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

`str` : |
Returns : |

### xmlMalloc()

    #define     xmlMalloc(size)

Wrapper for the malloc() function used in the XML library.

`size` : |

### xmlRealloc()

    #define     xmlRealloc(ptr, size)

Wrapper for the realloc() function used in the XML library.

`ptr` : |
`size` : |

### xmlMemStrdup()

    #define     xmlMemStrdup(str)

Wrapper for the strdup() function, xmlStrdup() is usually preferred.

`str` : |

### xmlMallocLoc ()

    void*       xmlMallocLoc                    (size_t size,
                                                 const char *file,
                                                 int line);

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

`size` : |
`file` : |
`line` : |

### xmlReallocLoc ()

    void*       xmlReallocLoc                   (void *ptr,
                                                 size_t size,
                                                 const char *file,
                                                 int line);

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

`ptr` : |
`size` : |
`file` : |
`line` : |

### xmlMemStrdupLoc ()

    char*       xmlMemStrdupLoc                 (const char *str,
                                                 const char *file,
                                                 int line);

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

`str` : |
`file` : |
`line` : |
Returns : |

<<< Previous Page | Home | Up | Next Page >>>
debugXML | xmlregexp