ReactOS 0.4.16-dev-973-g9a0ff8b
|
#include "libxml.h"
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <time.h>
#include <libxml/globals.h>
#include <libxml/xmlmemory.h>
#include <libxml/xmlerror.h>
#include <libxml/threads.h>
Go to the source code of this file.
Classes | |
struct | memnod |
Macros | |
#define | IN_LIBXML |
#define | MEMTAG 0x5aa5U |
#define | MALLOC_TYPE 1 |
#define | REALLOC_TYPE 2 |
#define | STRDUP_TYPE 3 |
#define | MALLOC_ATOMIC_TYPE 4 |
#define | REALLOC_ATOMIC_TYPE 5 |
#define | ALIGN_SIZE sizeof(double) |
#define | HDR_SIZE sizeof(MEMHDR) |
#define | RESERVE_SIZE |
#define | MAX_SIZE_T ((size_t)-1) |
#define | CLIENT_2_HDR(a) ((void *) (((char *) (a)) - RESERVE_SIZE)) |
#define | HDR_2_CLIENT(a) ((void *) (((char *) (a)) + RESERVE_SIZE)) |
#define | Mem_Tag_Err(a) debugmem_tag_error(a); |
#define | TEST_POINT |
Typedefs | |
typedef struct memnod | MEMHDR |
Variables | |
static int | xmlMemInitialized = 0 |
static unsigned long | debugMemSize = 0 |
static unsigned long | debugMemBlocks = 0 |
static unsigned long | debugMaxMemSize = 0 |
static xmlMutexPtr | xmlMemMutex = NULL |
static unsigned int | block =0 |
static unsigned int | xmlMemStopAtBlock = 0 |
static void * | xmlMemTraceBlockAt = NULL |
Definition at line 89 of file xmlmemory.c.
Definition at line 97 of file xmlmemory.c.
Definition at line 98 of file xmlmemory.c.
Definition at line 91 of file xmlmemory.c.
#define IN_LIBXML |
Definition at line 7 of file xmlmemory.c.
#define MALLOC_ATOMIC_TYPE 4 |
Definition at line 69 of file xmlmemory.c.
#define MALLOC_TYPE 1 |
Definition at line 66 of file xmlmemory.c.
Definition at line 95 of file xmlmemory.c.
#define Mem_Tag_Err | ( | a | ) | debugmem_tag_error(a); |
Definition at line 113 of file xmlmemory.c.
#define MEMTAG 0x5aa5U |
Definition at line 64 of file xmlmemory.c.
#define REALLOC_ATOMIC_TYPE 5 |
Definition at line 70 of file xmlmemory.c.
#define REALLOC_TYPE 2 |
Definition at line 67 of file xmlmemory.c.
#define RESERVE_SIZE |
Definition at line 92 of file xmlmemory.c.
#define STRDUP_TYPE 3 |
Definition at line 68 of file xmlmemory.c.
#define TEST_POINT |
Definition at line 116 of file xmlmemory.c.
Definition at line 841 of file xmlmemory.c.
xmlCleanupMemory:
DEPRECATED: This function will be made private. Call xmlCleanupParser to free global state but see the warnings there. xmlCleanupParser should be only called once at program exit. In most cases, you don't have call cleanup functions at all.
Free up all the memory allocated by the library for its own use. This should not be called by user level code.
Definition at line 989 of file xmlmemory.c.
Referenced by xmlCleanupParser().
int xmlGcMemGet | ( | xmlFreeFunc * | freeFunc, |
xmlMallocFunc * | mallocFunc, | ||
xmlMallocFunc * | mallocAtomicFunc, | ||
xmlReallocFunc * | reallocFunc, | ||
xmlStrdupFunc * | strdupFunc | ||
) |
xmlGcMemGet: @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
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
Returns 0 on success
Definition at line 1132 of file xmlmemory.c.
int xmlGcMemSetup | ( | xmlFreeFunc | freeFunc, |
xmlMallocFunc | mallocFunc, | ||
xmlMallocFunc | mallocAtomicFunc, | ||
xmlReallocFunc | reallocFunc, | ||
xmlStrdupFunc | strdupFunc | ||
) |
xmlGcMemSetup: @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
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 ?
Returns 0 on success
Definition at line 1088 of file xmlmemory.c.
xmlInitMemory:
DEPRECATED: This function will be made private. Call xmlInitParser to initialize the library.
Initialize the memory layer.
Returns 0 on success
Definition at line 946 of file xmlmemory.c.
Referenced by xmlInitParser(), xmlMallocAtomicLoc(), xmlMallocLoc(), xmlMemStrdupLoc(), and xmlReallocLoc().
Definition at line 221 of file xmlmemory.c.
xmlMallocBreakpoint:
Breakpoint to use in conjunction with xmlMemStopAtBlock. When the block number reaches the specified value this function is called. One need to add a breakpoint to it to get the context in which the given block is allocated.
Definition at line 128 of file xmlmemory.c.
Referenced by xmlMallocAtomicLoc(), xmlMallocLoc(), xmlMemFree(), xmlMemStrdupLoc(), and xmlReallocLoc().
Definition at line 145 of file xmlmemory.c.
Referenced by xmlMemMalloc(), and xmlReallocLoc().
xmlMemBlocks:
Provides the number of memory areas currently allocated
Returns an int representing the number of blocks
Definition at line 586 of file xmlmemory.c.
xmlMemDisplay: @fp: a FILE descriptor used as the output file, if NULL, the result is written to the file .memorylist
show in-extenso the memory blocks allocated
Definition at line 739 of file xmlmemory.c.
Referenced by debugmem_tag_error(), and xmlMemoryDump().
xmlMemDisplayLast: @fp: a FILE descriptor used as the output file, if NULL, the result is written to the file .memorylist @nbBytes: the amount of memory to dump
the last nbBytes of memory allocated and not freed, useful for dumping the memory left allocated between two places at runtime.
Definition at line 668 of file xmlmemory.c.
xmlMemFree: @ptr: the memory block pointer
a free() equivalent, with error checking.
Definition at line 414 of file xmlmemory.c.
Referenced by myFreeFunc(), myMallocFunc(), myReallocFunc(), and xmlInitializeGlobalState().
int xmlMemGet | ( | xmlFreeFunc * | freeFunc, |
xmlMallocFunc * | mallocFunc, | ||
xmlReallocFunc * | reallocFunc, | ||
xmlStrdupFunc * | strdupFunc | ||
) |
xmlMemGet: @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
Provides the memory access functions set currently in use
Returns 0 on success
Definition at line 1060 of file xmlmemory.c.
xmlMemMalloc: @size: an int specifying the size in byte to allocate.
a malloc() equivalent, with logging of the allocation info.
Returns a pointer to the allocated area or NULL in case of lack of memory.
Definition at line 294 of file xmlmemory.c.
Referenced by myMallocFunc(), and xmlInitializeGlobalState().
xmlMemoryDump:
Dump in-extenso the memory blocks allocated to the file .memorylist
Definition at line 910 of file xmlmemory.c.
Referenced by main(), xmlMallocAtomicLoc(), xmlMallocLoc(), xmlMemStrdupLoc(), and xmlReallocLoc().
xmlMemoryStrdup: @str: the initial string pointer
a strdup() equivalent, with logging of the allocation info.
Returns a pointer to the new string or NULL if allocation error occurred.
Definition at line 555 of file xmlmemory.c.
Referenced by myStrdupFunc(), and xmlInitializeGlobalState().
xmlMemRealloc: @ptr: the initial memory block pointer @size: an int specifying the size in byte to allocate.
a realloc() equivalent, with logging of the allocation info.
Returns a pointer to the allocated area or NULL in case of lack of memory.
Definition at line 403 of file xmlmemory.c.
Referenced by myReallocFunc(), and xmlInitializeGlobalState().
int xmlMemSetup | ( | xmlFreeFunc | freeFunc, |
xmlMallocFunc | mallocFunc, | ||
xmlReallocFunc | reallocFunc, | ||
xmlStrdupFunc | strdupFunc | ||
) |
xmlMemSetup: @freeFunc: the free() function to use @mallocFunc: the malloc() function to use @reallocFunc: the realloc() function to use @strdupFunc: the strdup() function to use
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 ?
Returns 0 on success
Definition at line 1022 of file xmlmemory.c.
Referenced by main().
xmlMemShow: @fp: a FILE descriptor used as the output file @nr: number of entries to dump
show a show display of the memory allocated, and dump the @nr last allocated areas which were not freed
Definition at line 865 of file xmlmemory.c.
Definition at line 490 of file xmlmemory.c.
Referenced by xmlMemoryStrdup().
xmlMemUsed:
Provides the amount of memory currently allocated
Returns an int representing the amount of memory allocated.
Definition at line 568 of file xmlmemory.c.
Referenced by myMallocFunc(), myReallocFunc(), and myStrdupFunc().
Definition at line 312 of file xmlmemory.c.
Referenced by xmlMemRealloc().
Definition at line 101 of file xmlmemory.c.
Referenced by __declspec(), __find_get_block(), __getblk(), _aligned_free_base(), _aligned_msize_base(), _aligned_offset_realloc_base(), _aligned_offset_recalloc_base(), _aligned_realloc_base(), _aligned_recalloc_base(), _chm_decompress_block(), _chm_get_cmpblock_bounds(), absynth_1to1_i486(), add_block(), add_block_index(), add_data_block(), add_data_to_folder(), add_typeinfo_block(), adns__transfer_interim(), tinyxml2::MemPoolT< SIZE >::Alloc(), alloc_pioinfo_block(), allocate_block(), append_data(), AVIFILE_SamplesToBlock(), Base64ToBinary(), blake2b_compress(), block_size(), BlockChainStream_GetBlockAtOffset(), chksum_crc32(), codeview_snarf(), copy_data_blocks(), create_io_inherit_block(), create_library_block(), ctl2_alloc_segment(), d3dx_effect_ApplyParameterBlock(), d3dx_effect_cleanup(), decode_block(), decode_mcu(), decode_mcu_AC_first(), decode_mcu_AC_refine(), decode_mcu_DC_first(), decode_mcu_sub(), desfunc(), dwarf2_parse_inlined_subroutine(), dwarf2_parse_subprogram_block(), dwarf2_parse_variable(), encode_mcu(), encode_mcu_AC_first(), encode_mcu_AC_refine(), encode_one_block(), Slicer::evalRBArray(), ext2_alloc_block(), ext2_block_map(), ext2_mkdir(), ext2_new_dir_block(), ext2_read_block(), ext2_test_block_bitmap(), ext2_test_block_bitmap_range(), ext2_write_block(), Ext2AddDotEntries(), Ext2LoadBuffer(), Ext2SaveBuffer(), Ext2ZeroBuffer(), ext3_add_entry(), ext3_append(), ext3_bread(), ext3_find_entry(), ext4_block_in_group(), ext4_ext_binsearch(), ext4_ext_binsearch_idx(), ext4_ext_find_goal(), ext4_ext_pblock(), ext4_ext_rm_leaf(), ext4_ext_search_right(), ext4_find_extent(), ext4_free_blocks(), ext4_idx_pblock(), ext4_new_meta_blocks(), ext_to_block(), extents_bread(), extents_bwrite(), FCIDestroy(), FDSA_InsertItem(), fill_delegated_proxy_table(), fill_delegated_stub_table(), fill_stubless_table(), for(), free_data_block(), free_folder(), free_parameter_block(), ft_free(), ft_mem_alloc(), ft_mem_qalloc(), ft_mem_qrealloc(), ft_mem_realloc(), ft_realloc(), fwpolicy2_get_BlockAllInboundTraffic(), fwpolicy2_put_BlockAllInboundTraffic(), get_block_bh(), get_block_bh_mdl(), get_block_bh_pin(), get_cache_glyph(), get_cache_glyph_widths(), get_file_version(), get_valid_parameter_block(), gl_destroy_list(), hash(), htest_one_block(), IAVIStream_fnRead(), idx_to_block(), if(), III_hybrid(), ImmDestroyIMCC(), ldap_memfreeA(), ldap_memfreeW(), map_bh(), ntom_ins2outs(), OleUnblockServer(), ParseSharedPacket(), pending_flush(), record_parameter(), sb_bread(), sb_find_get_block(), sb_getblk(), sb_getblk_zero(), select_heap(), set_cache_glyph(), set_cache_glyph_widths(), sltg_add_typeinfo(), sltg_write_header(), sltg_write_typeinfo(), stabs_parse(), StartBalanceW(), surface_cpu_blt_compressed(), swap_endian(), symt_add_func_local(), symt_close_func_block(), symt_enum_locals_helper(), symt_open_func_block(), test_effect_parameter_block(), test_FDICopy(), test_fdsa(), UDFProcessSequence(), UDFReadVDS(), UDFUpdateVDS(), UDFVerifySequence(), urlcache_entry_alloc(), urlcache_entry_free(), write_data_blocks(), xmlMallocAtomicLoc(), xmlMallocLoc(), and xmlMemStrdupLoc().
Definition at line 37 of file xmlmemory.c.
Referenced by xmlMallocAtomicLoc(), xmlMallocLoc(), xmlMemDisplay(), xmlMemDisplayLast(), xmlMemoryDump(), xmlMemShow(), xmlMemStrdupLoc(), and xmlReallocLoc().
Definition at line 36 of file xmlmemory.c.
Referenced by xmlMallocAtomicLoc(), xmlMallocLoc(), xmlMemBlocks(), xmlMemFree(), xmlMemStrdupLoc(), and xmlReallocLoc().
Definition at line 35 of file xmlmemory.c.
Referenced by xmlMallocAtomicLoc(), xmlMallocLoc(), xmlMemDisplay(), xmlMemDisplayLast(), xmlMemFree(), xmlMemShow(), xmlMemStrdupLoc(), xmlMemUsed(), and xmlReallocLoc().
|
static |
MEM_LIST:
keep track of all allocated blocks for error reporting Always build the memory list !
Definition at line 34 of file xmlmemory.c.
Referenced by xmlCleanupMemory(), xmlInitMemory(), xmlMallocAtomicLoc(), xmlMallocLoc(), xmlMemStrdupLoc(), and xmlReallocLoc().
|
static |
Definition at line 38 of file xmlmemory.c.
Referenced by xmlCleanupMemory(), xmlInitMemory(), xmlMallocAtomicLoc(), xmlMallocLoc(), xmlMemBlocks(), xmlMemDisplay(), xmlMemDisplayLast(), xmlMemFree(), xmlMemShow(), xmlMemStrdupLoc(), xmlMemUsed(), and xmlReallocLoc().
Definition at line 102 of file xmlmemory.c.
Referenced by xmlInitMemory(), xmlMallocAtomicLoc(), xmlMallocBreakpoint(), xmlMallocLoc(), xmlMemFree(), xmlMemStrdupLoc(), and xmlReallocLoc().
Definition at line 103 of file xmlmemory.c.
Referenced by xmlInitMemory(), xmlMallocAtomicLoc(), xmlMallocLoc(), xmlMemFree(), xmlMemStrdupLoc(), and xmlReallocLoc().