diff options
Diffstat (limited to 'vpx_mem/include')
-rw-r--r-- | vpx_mem/include/vpx_mem_intrnl.h | 46 | ||||
-rw-r--r-- | vpx_mem/include/vpx_mem_tracker.h | 179 |
2 files changed, 0 insertions, 225 deletions
diff --git a/vpx_mem/include/vpx_mem_intrnl.h b/vpx_mem/include/vpx_mem_intrnl.h index b5762cf5a..555995634 100644 --- a/vpx_mem/include/vpx_mem_intrnl.h +++ b/vpx_mem/include/vpx_mem_intrnl.h @@ -13,21 +13,10 @@ #define VPX_MEM_INCLUDE_VPX_MEM_INTRNL_H_ #include "./vpx_config.h" -#ifndef CONFIG_MEM_TRACKER -# define CONFIG_MEM_TRACKER 1 /*include xvpx_* calls in the lib*/ -#endif - #ifndef USE_GLOBAL_FUNCTION_POINTERS # define USE_GLOBAL_FUNCTION_POINTERS 0 /*use function pointers instead of compiled functions.*/ #endif -#if CONFIG_MEM_TRACKER -# include "vpx_mem_tracker.h" -# if VPX_MEM_TRACKER_VERSION_CHIEF != 2 || VPX_MEM_TRACKER_VERSION_MAJOR != 5 -# error "vpx_mem requires memory tracker version 2.5 to track memory usage" -# endif -#endif - #define ADDRESS_STORAGE_SIZE sizeof(size_t) #ifndef DEFAULT_ALIGNMENT @@ -40,41 +29,6 @@ than vpx_memalign*/ # endif #endif -#if CONFIG_MEM_TRACKER -# define TRY_BOUNDS_CHECK 1 /*when set to 1 pads each allocation, -integrity can be checked using -vpx_memory_tracker_check_integrity -or on free by defining*/ -/*TRY_BOUNDS_CHECK_ON_FREE*/ -#else -# define TRY_BOUNDS_CHECK 0 -#endif /*CONFIG_MEM_TRACKER*/ - -#if TRY_BOUNDS_CHECK -# define TRY_BOUNDS_CHECK_ON_FREE 0 /*checks mem integrity on every -free, very expensive*/ -# define BOUNDS_CHECK_VALUE 0xdeadbeef /*value stored before/after ea. -mem addr for bounds checking*/ -# define BOUNDS_CHECK_PAD_SIZE 32 /*size of the padding before and -after ea allocation to be filled -with BOUNDS_CHECK_VALUE. -this should be a multiple of 4*/ -#else -# define BOUNDS_CHECK_VALUE 0 -# define BOUNDS_CHECK_PAD_SIZE 0 -#endif /*TRY_BOUNDS_CHECK*/ - -#ifndef REMOVE_PRINTFS -# define REMOVE_PRINTFS 0 -#endif - -/* Should probably use a vpx_mem logger function. */ -#if REMOVE_PRINTFS -# define _P(x) -#else -# define _P(x) x -#endif - /*returns an addr aligned to the byte boundary specified by align*/ #define align_addr(addr,align) (void*)(((size_t)(addr) + ((align) - 1)) & (size_t)-(align)) diff --git a/vpx_mem/include/vpx_mem_tracker.h b/vpx_mem/include/vpx_mem_tracker.h deleted file mode 100644 index 1335e0017..000000000 --- a/vpx_mem/include/vpx_mem_tracker.h +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright (c) 2010 The WebM project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - - -#ifndef VPX_MEM_INCLUDE_VPX_MEM_TRACKER_H_ -#define VPX_MEM_INCLUDE_VPX_MEM_TRACKER_H_ - -/* vpx_mem_tracker version info */ -#define vpx_mem_tracker_version "2.5.1.1" - -#define VPX_MEM_TRACKER_VERSION_CHIEF 2 -#define VPX_MEM_TRACKER_VERSION_MAJOR 5 -#define VPX_MEM_TRACKER_VERSION_MINOR 1 -#define VPX_MEM_TRACKER_VERSION_PATCH 1 -/* END - vpx_mem_tracker version info */ - -#include <stdarg.h> - -struct mem_block { - size_t addr; - unsigned int size, - line; - char *file; - struct mem_block *prev, - * next; - - int padded; // This mem_block has padding for integrity checks. - // As of right now, this should only be 0 if - // using vpx_mem_alloc to allocate cache memory. - // 2005-01-11 tjf -}; - -#if defined(__cplusplus) -extern "C" { -#endif - - /* - vpx_memory_tracker_init(int padding_size, int pad_value) - padding_size - the size of the padding before and after each mem addr. - Values > 0 indicate that integrity checks can be performed - by inspecting these areas. - pad_value - the initial value within the padding area before and after - each mem addr. - - Initializes the memory tracker interface. Should be called before any - other calls to the memory tracker. - */ - int vpx_memory_tracker_init(int padding_size, int pad_value); - - /* - vpx_memory_tracker_destroy() - Deinitializes the memory tracker interface - */ - void vpx_memory_tracker_destroy(); - - /* - vpx_memory_tracker_add(size_t addr, unsigned int size, - char * file, unsigned int line) - addr - memory address to be added to list - size - size of addr - file - the file addr was referenced from - line - the line in file addr was referenced from - Adds memory address addr, it's size, file and line it came from - to the memory tracker allocation table - */ - void vpx_memory_tracker_add(size_t addr, unsigned int size, - char *file, unsigned int line, - int padded); - - /* - vpx_memory_tracker_add(size_t addr, unsigned int size, char * file, unsigned int line) - addr - memory address to be added to be removed - padded - if 0, disables bounds checking on this memory block even if bounds - checking is enabled. (for example, when allocating cache memory, we still want - to check for memory leaks, but we do not waste cache space for bounds check padding) - Removes the specified address from the memory tracker's allocation - table - Return: - 0: on success - -1: if memory allocation table's mutex could not be locked - -2: if the addr was not found in the list - */ - int vpx_memory_tracker_remove(size_t addr); - - /* - vpx_memory_tracker_find(unsigned int addr) - addr - address to be found in the memory tracker's - allocation table - Return: - If found, pointer to the memory block that matches addr - NULL otherwise - */ - struct mem_block *vpx_memory_tracker_find(size_t addr); - - /* - vpx_memory_tracker_dump() - Dumps the current contents of the memory - tracker allocation table - */ - void vpx_memory_tracker_dump(); - - /* - vpx_memory_tracker_check_integrity() - If a padding_size was provided to vpx_memory_tracker_init() - This function will verify that the region before and after each - memory address contains the specified pad_value. Should the check - fail, the filename and line of the check will be printed out. - */ - void vpx_memory_tracker_check_integrity(char *file, unsigned int line); - - /* - vpx_memory_tracker_set_log_type - type - value representing the logging type to use - option - type specific option. This will be interpreted differently - based on the type. - Sets the logging type for the memory tracker. - Values currently supported: - 0: if option is NULL, log to stderr, otherwise interpret option as a - filename and attempt to open it. - 1: Use output_debug_string (WIN32 only), option ignored - Return: - 0: on success - -1: if the logging type could not be set, because the value was invalid - or because a file could not be opened - */ - int vpx_memory_tracker_set_log_type(int type, char *option); - - /* - vpx_memory_tracker_set_log_func - userdata - ptr to be passed to the supplied logfunc, can be NULL - logfunc - the logging function to be used to output data from - vpx_memory_track_dump/check_integrity - Sets a logging function to be used by the memory tracker. - Return: - 0: on success - -1: if the logging type could not be set because logfunc was NULL - */ - int vpx_memory_tracker_set_log_func(void *userdata, - void(*logfunc)(void *userdata, - const char *fmt, va_list args)); - - /* Wrappers to standard library functions. */ - typedef void *(* mem_track_malloc_func)(size_t); - typedef void *(* mem_track_calloc_func)(size_t, size_t); - typedef void *(* mem_track_realloc_func)(void *, size_t); - typedef void (* mem_track_free_func)(void *); - typedef void *(* mem_track_memcpy_func)(void *, const void *, size_t); - typedef void *(* mem_track_memset_func)(void *, int, size_t); - typedef void *(* mem_track_memmove_func)(void *, const void *, size_t); - - /* - vpx_memory_tracker_set_functions - - Sets the function pointers for the standard library functions. - - Return: - 0: on success - -1: if the use global function pointers is not set. - */ - int vpx_memory_tracker_set_functions(mem_track_malloc_func g_malloc_l -, mem_track_calloc_func g_calloc_l -, mem_track_realloc_func g_realloc_l -, mem_track_free_func g_free_l -, mem_track_memcpy_func g_memcpy_l -, mem_track_memset_func g_memset_l -, mem_track_memmove_func g_memmove_l); - -#if defined(__cplusplus) -} -#endif - -#endif // VPX_MEM_INCLUDE_VPX_MEM_TRACKER_H_ |