Commit 26ce6c65 authored by marko's avatar marko

Merge r1739 from branches/zip:

mem_heap_free_heap_top(): Declare the memory freed with UNIV_MEM_FREE().
Before this change, the memory freed by mem_heap_empty() was not completely
flagged free in UNIV_DEBUG_VALGRIND builds.  After this change, Valgrind
will hopefully catch all errors caught by UNIV_MEM_DEBUG.
parent af29e769
...@@ -271,15 +271,19 @@ mem_heap_free_heap_top( ...@@ -271,15 +271,19 @@ mem_heap_free_heap_top(
ut_ad(mem_block_get_start(block) <= mem_block_get_free(block)); ut_ad(mem_block_get_start(block) <= mem_block_get_free(block));
/* In the debug version erase block from top up */ /* In the debug version erase block from top up */
{
mem_erase_buf(old_top, (byte*)block + block->len - old_top); ulint len = (byte*)block + block->len - old_top;
mem_erase_buf(old_top, len);
UNIV_MEM_FREE(old_top, len);
}
/* Update allocated memory count */ /* Update allocated memory count */
mutex_enter(&mem_hash_mutex); mutex_enter(&mem_hash_mutex);
mem_current_allocated_memory -= (total_size - size); mem_current_allocated_memory -= (total_size - size);
mutex_exit(&mem_hash_mutex); mutex_exit(&mem_hash_mutex);
#else /* UNIV_MEM_DEBUG */
#endif UNIV_MEM_FREE(old_top, (byte*)block + block->len - old_top);
#endif /* UNIV_MEM_DEBUG */
/* If free == start, we may free the block if it is not the first /* If free == start, we may free the block if it is not the first
one */ one */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment