summaryrefslogtreecommitdiff
path: root/storage/innobase
diff options
context:
space:
mode:
Diffstat (limited to 'storage/innobase')
-rw-r--r--storage/innobase/buf/buf0buf.c8
-rw-r--r--storage/innobase/include/mem0mem.ic4
-rw-r--r--storage/innobase/include/os0proc.h11
-rw-r--r--storage/innobase/include/univ.i17
-rw-r--r--storage/innobase/include/ut0mem.h26
-rw-r--r--storage/innobase/mem/mem0pool.c6
-rw-r--r--storage/innobase/os/os0proc.c33
-rw-r--r--storage/innobase/ut/ut0mem.c65
8 files changed, 8 insertions, 162 deletions
diff --git a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
index 78b39812cff..5463098a654 100644
--- a/storage/innobase/buf/buf0buf.c
+++ b/storage/innobase/buf/buf0buf.c
@@ -634,7 +634,7 @@ buf_pool_init(
/*----------------------------------------*/
} else {
buf_pool->frame_mem = os_mem_alloc_large(
- UNIV_PAGE_SIZE * (n_frames + 1), TRUE, FALSE);
+ UNIV_PAGE_SIZE * (n_frames + 1), FALSE);
}
if (buf_pool->frame_mem == NULL) {
@@ -756,12 +756,8 @@ buf_pool_init(
block = buf_pool_get_nth_block(buf_pool, i);
if (block->frame) {
- /* Wipe contents of frame to eliminate a Purify
- warning */
+ UNIV_MEM_INVALID(block->frame, UNIV_PAGE_SIZE);
-#ifdef HAVE_purify
- memset(block->frame, '\0', UNIV_PAGE_SIZE);
-#endif
if (srv_use_awe) {
/* Add to the list of blocks mapped to
frames */
diff --git a/storage/innobase/include/mem0mem.ic b/storage/innobase/include/mem0mem.ic
index 782672dbc18..0191e9a3ffd 100644
--- a/storage/innobase/include/mem0mem.ic
+++ b/storage/innobase/include/mem0mem.ic
@@ -195,10 +195,6 @@ mem_heap_alloc(
buf = (byte*)buf + MEM_FIELD_HEADER_SIZE;
#endif
-#ifdef UNIV_SET_MEM_TO_ZERO
- UNIV_MEM_ALLOC(buf, n);
- memset(buf, '\0', n);
-#endif
UNIV_MEM_ALLOC(buf, n);
return(buf);
}
diff --git a/storage/innobase/include/os0proc.h b/storage/innobase/include/os0proc.h
index f54e08de7ee..8c169f92431 100644
--- a/storage/innobase/include/os0proc.h
+++ b/storage/innobase/include/os0proc.h
@@ -104,14 +104,6 @@ ulint
os_proc_get_number(void);
/*====================*/
/********************************************************************
-Allocates non-cacheable memory. */
-
-void*
-os_mem_alloc_nocache(
-/*=================*/
- /* out: allocated memory */
- ulint n); /* in: number of bytes */
-/********************************************************************
Allocates large pages memory. */
void*
@@ -119,9 +111,6 @@ os_mem_alloc_large(
/*===============*/
/* out: allocated memory */
ulint n, /* in: number of bytes */
- ibool set_to_zero, /* in: TRUE if allocated memory
- should be set to zero if
- UNIV_SET_MEM_TO_ZERO is defined */
ibool assert_on_error);/* in: if TRUE, we crash mysqld if
the memory cannot be allocated */
/********************************************************************
diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i
index a67b1b3895e..4ac0809bcd2 100644
--- a/storage/innobase/include/univ.i
+++ b/storage/innobase/include/univ.i
@@ -72,14 +72,6 @@ Microsoft Visual C++ */
/* 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_INIT_MEM_TO_ZERO
-*/
-
/* Make a non-inline debug version */
#if defined HAVE_VALGRIND
@@ -112,15 +104,6 @@ operations (very slow); also UNIV_DEBUG must be defined */
#define UNIV_BTR_DEBUG /* check B-tree links */
#define UNIV_LIGHT_MEM_DEBUG /* light memory debugging */
-#ifdef HAVE_purify
-/* The following sets all new allocated memory to zero before use:
-this can be used to eliminate unnecessary Purify warnings, but note that
-it also masks many bugs Purify could detect. For detailed Purify analysis it
-is best to remove the define below and look through the warnings one
-by one. */
-#define UNIV_SET_MEM_TO_ZERO
-#endif
-
/*
#define UNIV_SQL_DEBUG
#define UNIV_LOG_DEBUG
diff --git a/storage/innobase/include/ut0mem.h b/storage/innobase/include/ut0mem.h
index cb369e85c39..0dff70abc3a 100644
--- a/storage/innobase/include/ut0mem.h
+++ b/storage/innobase/include/ut0mem.h
@@ -30,38 +30,18 @@ ut_memcmp(const void* str1, const 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. */
+Allocates memory. */
void*
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 */
ibool assert_on_error); /* in: if TRUE, we crash mysqld if
the memory cannot be allocated */
/**************************************************************************
-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 */
-/**************************************************************************
-Tests if malloc of n bytes would succeed. ut_malloc() asserts if memory runs
-out. It cannot be used if we want to return an error message. Prints to
-stderr a message if fails. */
-
-ibool
-ut_test_malloc(
-/*===========*/
- /* out: TRUE if succeeded */
- ulint n); /* in: try to allocate this many bytes */
+Allocates memory. */
+#define ut_malloc(n) ut_malloc_low(n, TRUE)
/**************************************************************************
Frees a memory block allocated with ut_malloc. */
diff --git a/storage/innobase/mem/mem0pool.c b/storage/innobase/mem/mem0pool.c
index 27da86a0309..6740ff04a4f 100644
--- a/storage/innobase/mem/mem0pool.c
+++ b/storage/innobase/mem/mem0pool.c
@@ -196,11 +196,7 @@ mem_pool_create(
pool = ut_malloc(sizeof(mem_pool_t));
- /* We do not set the memory to zero (FALSE) in the pool,
- but only when allocated at a higher level in mem0mem.c.
- This is to avoid masking useful Purify warnings. */
-
- pool->buf = ut_malloc_low(size, FALSE, TRUE);
+ pool->buf = ut_malloc_low(size, TRUE);
pool->size = size;
mutex_create(&pool->mutex, SYNC_MEM_POOL);
diff --git a/storage/innobase/os/os0proc.c b/storage/innobase/os/os0proc.c
index f00475fc528..6092392616f 100644
--- a/storage/innobase/os/os0proc.c
+++ b/storage/innobase/os/os0proc.c
@@ -532,28 +532,6 @@ os_proc_get_number(void)
}
/********************************************************************
-Allocates non-cacheable memory. */
-
-void*
-os_mem_alloc_nocache(
-/*=================*/
- /* out: allocated memory */
- ulint n) /* in: number of bytes */
-{
-#ifdef __WIN__
- void* ptr;
-
- ptr = VirtualAlloc(NULL, n, MEM_COMMIT,
- PAGE_READWRITE | PAGE_NOCACHE);
- ut_a(ptr);
-
- return(ptr);
-#else
- return(ut_malloc(n));
-#endif
-}
-
-/********************************************************************
Allocates large pages memory. */
void*
@@ -561,9 +539,6 @@ os_mem_alloc_large(
/*===============*/
/* out: allocated memory */
ulint n, /* in: number of bytes */
- ibool set_to_zero, /* in: TRUE if allocated memory
- should be set to zero if
- UNIV_SET_MEM_TO_ZERO is defined */
ibool assert_on_error)/* in: if TRUE, we crash mysqld if
the memory cannot be allocated */
{
@@ -602,12 +577,6 @@ os_mem_alloc_large(
#endif
if (ptr) {
- if (set_to_zero) {
-#ifdef UNIV_SET_MEM_TO_ZERO
- memset(ptr, '\0', size);
-#endif
- }
-
return(ptr);
}
@@ -616,7 +585,7 @@ os_mem_alloc_large(
skip:
#endif /* HAVE_LARGE_PAGES */
- return(ut_malloc_low(n, set_to_zero, assert_on_error));
+ return(ut_malloc_low(n, assert_on_error));
}
/********************************************************************
diff --git a/storage/innobase/ut/ut0mem.c b/storage/innobase/ut/ut0mem.c
index 2e0dd27edf4..55f1c8593b8 100644
--- a/storage/innobase/ut/ut0mem.c
+++ b/storage/innobase/ut/ut0mem.c
@@ -54,17 +54,13 @@ ut_mem_block_list_init(void)
}
/**************************************************************************
-Allocates memory. Sets it also to zero if UNIV_SET_MEM_TO_ZERO is
-defined and set_to_zero is TRUE. */
+Allocates memory. */
void*
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 */
ibool assert_on_error)/* in: if TRUE, we crash mysqld if the
memory cannot be allocated */
{
@@ -156,12 +152,6 @@ retry:
#endif
}
- if (set_to_zero) {
-#ifdef UNIV_SET_MEM_TO_ZERO
- memset(ret, '\0', n + sizeof(ut_mem_block_t));
-#endif
- }
-
UNIV_MEM_ALLOC(ret, n + sizeof(ut_mem_block_t));
((ut_mem_block_t*)ret)->size = n + sizeof(ut_mem_block_t);
@@ -177,59 +167,6 @@ retry:
}
/**************************************************************************
-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 */
-{
- return(ut_malloc_low(n, TRUE, TRUE));
-}
-
-/**************************************************************************
-Tests if malloc of n bytes would succeed. ut_malloc() asserts if memory runs
-out. It cannot be used if we want to return an error message. Prints to
-stderr a message if fails. */
-
-ibool
-ut_test_malloc(
-/*===========*/
- /* out: TRUE if succeeded */
- ulint n) /* in: try to allocate this many bytes */
-{
- void* ret;
-
- ret = malloc(n);
-
- if (ret == NULL) {
- ut_print_timestamp(stderr);
- fprintf(stderr,
- " InnoDB: Error: cannot allocate"
- " %lu bytes of memory for\n"
- "InnoDB: a BLOB with malloc! Total allocated memory\n"
- "InnoDB: by InnoDB %lu bytes."
- " Operating system errno: %d\n"
- "InnoDB: Check if you should increase"
- " the swap file or\n"
- "InnoDB: ulimits of your operating system.\n"
- "InnoDB: On FreeBSD check you have"
- " compiled the OS with\n"
- "InnoDB: a big enough maximum process size.\n",
- (ulong) n,
- (ulong) ut_total_allocated_memory,
- (int) errno);
- return(FALSE);
- }
-
- free(ret);
-
- return(TRUE);
-}
-
-/**************************************************************************
Frees a memory block allocated with ut_malloc. */
void