diff options
-rw-r--r-- | storage/innobase/include/mem0mem.h | 2 | ||||
-rw-r--r-- | storage/innobase/include/mem0mem.ic | 9 | ||||
-rw-r--r-- | storage/innobase/log/log0recv.cc | 2 |
3 files changed, 9 insertions, 4 deletions
diff --git a/storage/innobase/include/mem0mem.h b/storage/innobase/include/mem0mem.h index 61f36b81a72..0b291e6f365 100644 --- a/storage/innobase/include/mem0mem.h +++ b/storage/innobase/include/mem0mem.h @@ -73,7 +73,7 @@ allocations of small buffers. */ /** If a memory heap is allowed to grow into the buffer pool, the following is the maximum size for a single allocated buffer: */ -#define MEM_MAX_ALLOC_IN_BUF (UNIV_PAGE_SIZE - 200) +#define MEM_MAX_ALLOC_IN_BUF (UNIV_PAGE_SIZE - 200 + REDZONE_SIZE) /** Space needed when allocating for a user a field of length N. The space is allocated only in multiples of UNIV_MEM_ALIGNMENT. */ diff --git a/storage/innobase/include/mem0mem.ic b/storage/innobase/include/mem0mem.ic index 9b1e9a2da31..a44f2ff45fa 100644 --- a/storage/innobase/include/mem0mem.ic +++ b/storage/innobase/include/mem0mem.ic @@ -183,13 +183,15 @@ mem_heap_alloc( ulint n) { mem_block_t* block; - void* buf; + byte* buf; ulint free; ut_d(mem_block_validate(heap)); block = UT_LIST_GET_LAST(heap->base); + n += REDZONE_SIZE; + ut_ad(!(block->type & MEM_HEAP_BUFFER) || (n <= MEM_MAX_ALLOC_IN_BUF)); /* Check if there is enough space in block. If not, create a new @@ -212,7 +214,8 @@ mem_heap_alloc( mem_block_set_free(block, free + MEM_SPACE_NEEDED(n)); - UNIV_MEM_ALLOC(buf, n); + buf = buf + REDZONE_SIZE; + UNIV_MEM_ALLOC(buf, n - REDZONE_SIZE); return(buf); } @@ -341,6 +344,8 @@ mem_heap_free_top( ut_d(mem_block_validate(heap)); + n += REDZONE_SIZE; + block = UT_LIST_GET_LAST(heap->base); /* Subtract the free field of block */ diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index dbce6f90fc2..a8b3ed4f837 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -61,7 +61,7 @@ Created 9/20/1997 Heikki Tuuri /** Log records are stored in the hash table in chunks at most of this size; this must be less than UNIV_PAGE_SIZE as it is stored in the buffer pool */ -#define RECV_DATA_BLOCK_SIZE (MEM_MAX_ALLOC_IN_BUF - sizeof(recv_data_t)) +#define RECV_DATA_BLOCK_SIZE (MEM_MAX_ALLOC_IN_BUF - sizeof(recv_data_t) - REDZONE_SIZE) /** Read-ahead area in applying log records to file pages */ #define RECV_READ_AHEAD_AREA 32 |