ReactOS
0.4.15-dev-1638-gc0caa5c
|
#include "libxml.h"
#include <string.h>
#include <sys/types.h>
#include <time.h>
#include <stdlib.h>
#include <ctype.h>
#include <libxml/globals.h>
#include <libxml/xmlmemory.h>
#include <libxml/xmlerror.h>
#include <libxml/threads.h>
#include "elfgcchack.h"
Go to the source code of this file.
Classes | |
struct | memnod |
Macros | |
#define | IN_LIBXML |
#define | MEMTAG 0x5aa5 |
#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 |
#define | bottom_xmlmemory |
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 106 of file xmlmemory.c.
#define bottom_xmlmemory |
Definition at line 1162 of file xmlmemory.c.
Definition at line 114 of file xmlmemory.c.
Definition at line 115 of file xmlmemory.c.
Definition at line 108 of file xmlmemory.c.
#define IN_LIBXML |
Definition at line 7 of file xmlmemory.c.
#define MALLOC_ATOMIC_TYPE 4 |
Definition at line 86 of file xmlmemory.c.
#define MALLOC_TYPE 1 |
Definition at line 83 of file xmlmemory.c.
Definition at line 112 of file xmlmemory.c.
#define Mem_Tag_Err | ( | a | ) | debugmem_tag_error(a); |
Definition at line 130 of file xmlmemory.c.
#define MEMTAG 0x5aa5 |
Definition at line 81 of file xmlmemory.c.
#define REALLOC_ATOMIC_TYPE 5 |
Definition at line 87 of file xmlmemory.c.
#define REALLOC_TYPE 2 |
Definition at line 84 of file xmlmemory.c.
#define RESERVE_SIZE |
Definition at line 109 of file xmlmemory.c.
#define STRDUP_TYPE 3 |
Definition at line 85 of file xmlmemory.c.
#define TEST_POINT |
Definition at line 133 of file xmlmemory.c.
Definition at line 862 of file xmlmemory.c.
xmlCleanupMemory:
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 1008 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 1151 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 1107 of file xmlmemory.c.
xmlInitMemory:
Initialize the memory layer.
Returns 0 on success
Definition at line 964 of file xmlmemory.c.
Referenced by xmlInitParser(), xmlMallocAtomicLoc(), xmlMallocLoc(), xmlMemStrdupLoc(), and xmlReallocLoc().
Definition at line 238 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 145 of file xmlmemory.c.
Referenced by xmlMallocAtomicLoc(), xmlMallocLoc(), xmlMemFree(), xmlMemStrdupLoc(), and xmlReallocLoc().
Definition at line 162 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 603 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 756 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 685 of file xmlmemory.c.
xmlMemFree: @ptr: the memory block pointer
a free() equivalent, with error checking.
Definition at line 431 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 1079 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 311 of file xmlmemory.c.
Referenced by myMallocFunc(), and xmlInitializeGlobalState().
xmlMemoryDump:
Dump in-extenso the memory blocks allocated to the file .memorylist
Definition at line 931 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 572 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 420 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 1041 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 886 of file xmlmemory.c.
Definition at line 507 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 585 of file xmlmemory.c.
Referenced by myMallocFunc(), myReallocFunc(), and myStrdupFunc().
Definition at line 329 of file xmlmemory.c.
Referenced by xmlMemRealloc().
Definition at line 118 of file xmlmemory.c.
Referenced by __find_get_block(), __getblk(), _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< sizeof(tinyxml2::XMLElement) >::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(), 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(), free_data_block(), free_folder(), 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(), gl_destroy_list(), hash(), htest_one_block(), IAVIStream_fnRead(), idx_to_block(), III_hybrid(), ImmDestroyIMCC(), ldap_memfreeA(), ldap_memfreeW(), map_bh(), ntom_ins2outs(), OleUnblockServer(), ParseSharedPacket(), pending_flush(), ptegreload(), reiserfs_new_unf_blocknrs(), reiserfs_new_unf_blocknrs2(), sb_bread(), sb_find_get_block(), sb_getblk(), sb_getblk_zero(), 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(), tcpip_callback_with_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 54 of file xmlmemory.c.
Referenced by xmlMallocAtomicLoc(), xmlMallocLoc(), xmlMemDisplay(), xmlMemDisplayLast(), xmlMemoryDump(), xmlMemShow(), xmlMemStrdupLoc(), and xmlReallocLoc().
Definition at line 53 of file xmlmemory.c.
Referenced by xmlMallocAtomicLoc(), xmlMallocLoc(), xmlMemBlocks(), xmlMemFree(), xmlMemStrdupLoc(), and xmlReallocLoc().
Definition at line 52 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 51 of file xmlmemory.c.
Referenced by xmlCleanupMemory(), xmlInitMemory(), xmlMallocAtomicLoc(), xmlMallocLoc(), xmlMemStrdupLoc(), and xmlReallocLoc().
|
static |
Definition at line 55 of file xmlmemory.c.
Referenced by xmlCleanupMemory(), xmlInitMemory(), xmlMallocAtomicLoc(), xmlMallocLoc(), xmlMemBlocks(), xmlMemDisplay(), xmlMemDisplayLast(), xmlMemFree(), xmlMemShow(), xmlMemStrdupLoc(), xmlMemUsed(), and xmlReallocLoc().
Definition at line 119 of file xmlmemory.c.
Referenced by xmlInitMemory(), xmlMallocAtomicLoc(), xmlMallocBreakpoint(), xmlMallocLoc(), xmlMemFree(), xmlMemStrdupLoc(), and xmlReallocLoc().
Definition at line 120 of file xmlmemory.c.
Referenced by xmlInitMemory(), xmlMallocAtomicLoc(), xmlMallocLoc(), xmlMemFree(), xmlMemStrdupLoc(), and xmlReallocLoc().