Loading innobase/include/mem0mem.ic +10 −2 Original line number Diff line number Diff line Loading @@ -170,7 +170,9 @@ mem_heap_alloc( buf = (byte*)buf + MEM_FIELD_HEADER_SIZE; #endif #ifdef UNIV_SET_MEM_TO_ZERO memset(buf, '\0', n); #endif return(buf); } Loading Loading @@ -494,8 +496,14 @@ mem_alloc_func( ) { #ifndef UNIV_MEM_DEBUG void* buf; return(mem_area_alloc(n, mem_comm_pool)); buf = mem_area_alloc(n, mem_comm_pool); #ifdef UNIV_SET_MEM_TO_ZERO memset(buf, '\0', n); #endif return(buf); #else Loading innobase/include/os0sync.h +1 −1 Original line number Diff line number Diff line Loading @@ -160,6 +160,7 @@ os_fast_mutex_trylock( was reserved by another thread */ os_fast_mutex_t* fast_mutex); /* in: mutex to acquire */ #endif /************************************************************** Releases ownership of a fast mutex. */ UNIV_INLINE Loading Loading @@ -188,7 +189,6 @@ void os_fast_mutex_free( /*===============*/ os_fast_mutex_t* fast_mutex); /* in: mutex to free */ #endif #ifndef UNIV_NONINL #include "os0sync.ic" Loading innobase/include/os0sync.ic +1 −1 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ os_fast_mutex_trylock( return((ulint) pthread_mutex_trylock(fast_mutex)); #endif } #endif /************************************************************** Releases ownership of a fast mutex. */ Loading @@ -53,4 +54,3 @@ os_fast_mutex_unlock( pthread_mutex_unlock(fast_mutex); #endif } #endif innobase/include/univ.i +6 −2 Original line number Diff line number Diff line Loading @@ -61,8 +61,12 @@ subdirectory of 'mysql'. */ /* DEBUG VERSION CONTROL ===================== */ /* The following flag will make InnoDB to initialize all memory it allocates to zero. It hides Purify warnings about reading unallocated memory unless memory is read outside the allocated blocks. */ /* #define UNIV_SYNC_DEBUG #define UNIV_INIT_MEM_TO_ZERO */ /* Make a non-inline debug version */ Loading @@ -72,7 +76,7 @@ subdirectory of 'mysql'. */ #define UNIV_SEARCH_DEBUG #define UNIV_IBUF_DEBUG #define UNIV_SYNC_DEBUG #define UNIV_SYNC_PERF_STAT #define UNIV_SEARCH_PERF_STAT */ Loading innobase/include/ut0mem.h +30 −3 Original line number Diff line number Diff line Loading @@ -26,12 +26,39 @@ int ut_memcmp(void* str1, void* str2, ulint n); /************************************************************************** Allocates memory. Sets it also to zero if UNIV_SET_MEM_TO_ZERO is defined and set_to_zero is TRUE. */ void* ut_malloc(ulint n); ut_malloc_low( /*==========*/ /* out, own: allocated memory */ ulint n, /* in: number of bytes to allocate */ ibool set_to_zero); /* in: TRUE if allocated memory should be set to zero if UNIV_SET_MEM_TO_ZERO is defined */ /************************************************************************** Allocates memory. Sets it also to zero if UNIV_SET_MEM_TO_ZERO is defined. */ void* ut_malloc( /*======*/ /* out, own: allocated memory */ ulint n); /* in: number of bytes to allocate */ /************************************************************************** Frees a memory bloock allocated with ut_malloc. */ void ut_free( /*====*/ void* ptr); /* in, own: memory block */ /************************************************************************** Frees all allocated memory not freed yet. */ UNIV_INLINE void ut_free(void* ptr); ut_free_all_mem(void); /*=================*/ UNIV_INLINE char* Loading Loading
innobase/include/mem0mem.ic +10 −2 Original line number Diff line number Diff line Loading @@ -170,7 +170,9 @@ mem_heap_alloc( buf = (byte*)buf + MEM_FIELD_HEADER_SIZE; #endif #ifdef UNIV_SET_MEM_TO_ZERO memset(buf, '\0', n); #endif return(buf); } Loading Loading @@ -494,8 +496,14 @@ mem_alloc_func( ) { #ifndef UNIV_MEM_DEBUG void* buf; return(mem_area_alloc(n, mem_comm_pool)); buf = mem_area_alloc(n, mem_comm_pool); #ifdef UNIV_SET_MEM_TO_ZERO memset(buf, '\0', n); #endif return(buf); #else Loading
innobase/include/os0sync.h +1 −1 Original line number Diff line number Diff line Loading @@ -160,6 +160,7 @@ os_fast_mutex_trylock( was reserved by another thread */ os_fast_mutex_t* fast_mutex); /* in: mutex to acquire */ #endif /************************************************************** Releases ownership of a fast mutex. */ UNIV_INLINE Loading Loading @@ -188,7 +189,6 @@ void os_fast_mutex_free( /*===============*/ os_fast_mutex_t* fast_mutex); /* in: mutex to free */ #endif #ifndef UNIV_NONINL #include "os0sync.ic" Loading
innobase/include/os0sync.ic +1 −1 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ os_fast_mutex_trylock( return((ulint) pthread_mutex_trylock(fast_mutex)); #endif } #endif /************************************************************** Releases ownership of a fast mutex. */ Loading @@ -53,4 +54,3 @@ os_fast_mutex_unlock( pthread_mutex_unlock(fast_mutex); #endif } #endif
innobase/include/univ.i +6 −2 Original line number Diff line number Diff line Loading @@ -61,8 +61,12 @@ subdirectory of 'mysql'. */ /* DEBUG VERSION CONTROL ===================== */ /* The following flag will make InnoDB to initialize all memory it allocates to zero. It hides Purify warnings about reading unallocated memory unless memory is read outside the allocated blocks. */ /* #define UNIV_SYNC_DEBUG #define UNIV_INIT_MEM_TO_ZERO */ /* Make a non-inline debug version */ Loading @@ -72,7 +76,7 @@ subdirectory of 'mysql'. */ #define UNIV_SEARCH_DEBUG #define UNIV_IBUF_DEBUG #define UNIV_SYNC_DEBUG #define UNIV_SYNC_PERF_STAT #define UNIV_SEARCH_PERF_STAT */ Loading
innobase/include/ut0mem.h +30 −3 Original line number Diff line number Diff line Loading @@ -26,12 +26,39 @@ int ut_memcmp(void* str1, void* str2, ulint n); /************************************************************************** Allocates memory. Sets it also to zero if UNIV_SET_MEM_TO_ZERO is defined and set_to_zero is TRUE. */ void* ut_malloc(ulint n); ut_malloc_low( /*==========*/ /* out, own: allocated memory */ ulint n, /* in: number of bytes to allocate */ ibool set_to_zero); /* in: TRUE if allocated memory should be set to zero if UNIV_SET_MEM_TO_ZERO is defined */ /************************************************************************** Allocates memory. Sets it also to zero if UNIV_SET_MEM_TO_ZERO is defined. */ void* ut_malloc( /*======*/ /* out, own: allocated memory */ ulint n); /* in: number of bytes to allocate */ /************************************************************************** Frees a memory bloock allocated with ut_malloc. */ void ut_free( /*====*/ void* ptr); /* in, own: memory block */ /************************************************************************** Frees all allocated memory not freed yet. */ UNIV_INLINE void ut_free(void* ptr); ut_free_all_mem(void); /*=================*/ UNIV_INLINE char* Loading