Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
3366420b
Commit
3366420b
authored
Jun 14, 2007
by
marko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Port extra Valgrind instrumentation (UNIV_DEBUG_VALGRIND) from branches/zip.
parent
4d1a51bb
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
66 additions
and
2 deletions
+66
-2
buf/buf0buf.c
buf/buf0buf.c
+9
-0
buf/buf0lru.c
buf/buf0lru.c
+13
-0
include/mem0mem.ic
include/mem0mem.ic
+6
-0
include/univ.i
include/univ.i
+14
-0
mem/mem0mem.c
mem/mem0mem.c
+1
-0
mem/mem0pool.c
mem/mem0pool.c
+6
-0
rem/rem0rec.c
rem/rem0rec.c
+5
-1
trx/trx0sys.c
trx/trx0sys.c
+10
-1
ut/ut0mem.c
ut/ut0mem.c
+2
-0
No files found.
buf/buf0buf.c
View file @
3366420b
...
...
@@ -1648,6 +1648,15 @@ buf_page_init(
block
->
lock_hash_val
=
lock_rec_hash
(
space
,
offset
);
#ifdef UNIV_DEBUG_VALGRIND
if
(
!
space
)
{
/* Silence valid Valgrind warnings about uninitialized
data being written to data files. There are some unused
bytes on some pages that InnoDB does not initialize. */
UNIV_MEM_VALID
(
block
->
frame
,
UNIV_PAGE_SIZE
);
}
#endif
/* UNIV_DEBUG_VALGRIND */
/* Insert into the hash table of file pages */
if
(
buf_page_hash_get
(
space
,
offset
))
{
...
...
buf/buf0lru.c
View file @
3366420b
...
...
@@ -244,7 +244,15 @@ buf_LRU_search_and_free_block(
frame at all */
if
(
block
->
frame
)
{
/* The page was declared uninitialized
by buf_LRU_block_remove_hashed_page().
We need to flag the contents of the
page valid (which it still is) in
order to avoid bogus Valgrind
warnings. */
UNIV_MEM_VALID
(
block
->
frame
,
UNIV_PAGE_SIZE
);
btr_search_drop_page_hash_index
(
block
->
frame
);
UNIV_MEM_INVALID
(
block
->
frame
,
UNIV_PAGE_SIZE
);
}
ut_a
(
block
->
buf_fix_count
==
0
);
...
...
@@ -449,6 +457,7 @@ loop:
mutex_enter
(
&
block
->
mutex
);
block
->
state
=
BUF_BLOCK_READY_FOR_USE
;
UNIV_MEM_ALLOC
(
block
->
frame
,
UNIV_PAGE_SIZE
);
mutex_exit
(
&
block
->
mutex
);
...
...
@@ -864,6 +873,7 @@ buf_LRU_block_free_non_file_page(
block
->
state
=
BUF_BLOCK_NOT_USED
;
UNIV_MEM_ALLOC
(
block
->
frame
,
UNIV_PAGE_SIZE
);
#ifdef UNIV_DEBUG
/* Wipe contents of page to reveal possible stale pointers to it */
memset
(
block
->
frame
,
'\0'
,
UNIV_PAGE_SIZE
);
...
...
@@ -871,6 +881,8 @@ buf_LRU_block_free_non_file_page(
UT_LIST_ADD_FIRST
(
free
,
buf_pool
->
free
,
block
);
block
->
in_free_list
=
TRUE
;
UNIV_MEM_FREE
(
block
->
frame
,
UNIV_PAGE_SIZE
);
if
(
srv_use_awe
&&
block
->
frame
)
{
/* Add to the list of mapped pages */
...
...
@@ -939,6 +951,7 @@ buf_LRU_block_remove_hashed_page(
buf_page_address_fold
(
block
->
space
,
block
->
offset
),
block
);
UNIV_MEM_INVALID
(
block
->
frame
,
UNIV_PAGE_SIZE
);
block
->
state
=
BUF_BLOCK_REMOVE_HASH
;
}
...
...
include/mem0mem.ic
View file @
3366420b
...
...
@@ -167,6 +167,8 @@ mem_heap_alloc(
mem_block_set_free(block, free + MEM_SPACE_NEEDED(n));
#ifdef UNIV_MEM_DEBUG
UNIV_MEM_ALLOC(buf,
n + MEM_FIELD_HEADER_SIZE + MEM_FIELD_TRAILER_SIZE);
/* In the debug version write debugging info to the field */
mem_field_init((byte*)buf, n);
...
...
@@ -177,8 +179,10 @@ mem_heap_alloc(
#endif
#ifdef UNIV_SET_MEM_TO_ZERO
UNIV_MEM_ALLOC(buf, n);
memset(buf, '\0', n);
#endif
UNIV_MEM_ALLOC(buf, n);
return(buf);
}
...
...
@@ -369,6 +373,8 @@ mem_heap_free_top(
if ((heap != block) && (mem_block_get_free(block)
== mem_block_get_start(block))) {
mem_heap_block_free(heap, block);
} else {
UNIV_MEM_FREE((byte*) block + mem_block_get_free(block), n);
}
}
...
...
include/univ.i
View file @
3366420b
...
...
@@ -83,6 +83,8 @@ memory is read outside the allocated blocks. */
/* Make a non-inline debug version */
#
if
0
#
define
UNIV_DEBUG_VALGRIND
/* Enable extra
Valgrind instrumentation */
#
define
UNIV_DEBUG
/* Enable ut_ad() assertions */
#
define
UNIV_LIST_DEBUG
/* debug UT_LIST_ macros */
#
define
UNIV_MEM_DEBUG
/* detect memory leaks etc */
...
...
@@ -298,5 +300,17 @@ typedef void* os_thread_ret_t;
#
include
"ut0dbg.h"
#
include
"ut0ut.h"
#
include
"db0err.h"
#
ifdef
UNIV_DEBUG_VALGRIND
#
include
<
valgrind
/
memcheck
.
h
>
#
define
UNIV_MEM_VALID
(
addr
,
size
)
VALGRIND_MAKE_MEM_DEFINED
(
addr
,
size
)
#
define
UNIV_MEM_INVALID
(
addr
,
size
)
VALGRIND_MAKE_MEM_UNDEFINED
(
addr
,
size
)
#
define
UNIV_MEM_FREE
(
addr
,
size
)
VALGRIND_MAKE_MEM_NOACCESS
(
addr
,
size
)
#
define
UNIV_MEM_ALLOC
(
addr
,
size
)
VALGRIND_MAKE_MEM_UNDEFINED
(
addr
,
size
)
#
else
#
define
UNIV_MEM_VALID
(
addr
,
size
)
do
{}
while
(
0
)
#
define
UNIV_MEM_INVALID
(
addr
,
size
)
do
{}
while
(
0
)
#
define
UNIV_MEM_FREE
(
addr
,
size
)
do
{}
while
(
0
)
#
define
UNIV_MEM_ALLOC
(
addr
,
size
)
do
{}
while
(
0
)
#
endif
#
endif
mem/mem0mem.c
View file @
3366420b
...
...
@@ -514,6 +514,7 @@ mem_heap_block_free(
mem_erase_buf
((
byte
*
)
block
,
len
);
#endif
UNIV_MEM_FREE
(
block
,
len
);
if
(
init_block
)
{
/* Do not have to free: do nothing */
...
...
mem/mem0pool.c
View file @
3366420b
...
...
@@ -229,6 +229,8 @@ mem_pool_create(
mem_area_set_size
(
area
,
ut_2_exp
(
i
));
mem_area_set_free
(
area
,
TRUE
);
UNIV_MEM_FREE
(
MEM_AREA_EXTRA_SIZE
+
(
byte
*
)
area
,
ut_2_exp
(
i
)
-
MEM_AREA_EXTRA_SIZE
);
UT_LIST_ADD_FIRST
(
free_list
,
pool
->
free_list
[
i
],
area
);
...
...
@@ -300,6 +302,7 @@ mem_pool_fill_free_list(
UT_LIST_REMOVE
(
free_list
,
pool
->
free_list
[
i
+
1
],
area
);
area2
=
(
mem_area_t
*
)(((
byte
*
)
area
)
+
ut_2_exp
(
i
));
UNIV_MEM_ALLOC
(
area2
,
MEM_AREA_EXTRA_SIZE
);
mem_area_set_size
(
area2
,
ut_2_exp
(
i
));
mem_area_set_free
(
area2
,
TRUE
);
...
...
@@ -400,6 +403,8 @@ mem_area_alloc(
mutex_exit
(
&
(
pool
->
mutex
));
ut_ad
(
mem_pool_validate
(
pool
));
UNIV_MEM_ALLOC
(
MEM_AREA_EXTRA_SIZE
+
(
byte
*
)
area
,
ut_2_exp
(
n
)
-
MEM_AREA_EXTRA_SIZE
);
return
((
void
*
)(
MEM_AREA_EXTRA_SIZE
+
((
byte
*
)
area
)));
}
...
...
@@ -482,6 +487,7 @@ mem_area_free(
}
size
=
mem_area_get_size
(
area
);
UNIV_MEM_FREE
(
ptr
,
size
-
MEM_AREA_EXTRA_SIZE
);
if
(
size
==
0
)
{
fprintf
(
stderr
,
...
...
rem/rem0rec.c
View file @
3366420b
...
...
@@ -753,7 +753,11 @@ rec_convert_dtuple_to_rec_old(
/* Calculate the offset of the origin in the physical record */
rec
=
buf
+
rec_get_converted_extra_size
(
data_size
,
n_fields
);
#ifdef UNIV_DEBUG
/* Suppress Valgrind warnings of ut_ad()
in mach_write_to_1(), mach_write_to_2() et al. */
memset
(
buf
,
0xff
,
rec
-
buf
+
data_size
);
#endif
/* UNIV_DEBUG */
/* Store the number of fields */
rec_set_n_fields_old
(
rec
,
n_fields
);
...
...
trx/trx0sys.c
View file @
3366420b
...
...
@@ -868,7 +868,16 @@ trx_sysf_create(
trx_sysf_rseg_set_page_no
(
sys_header
,
i
,
FIL_NULL
,
mtr
);
}
/* The remaining area (up to the page trailer) is uninitialized. */
/* The remaining area (up to the page trailer) is uninitialized.
Silence Valgrind warnings about it. */
UNIV_MEM_VALID
(
sys_header
+
(
TRX_SYS_RSEGS
+
TRX_SYS_N_RSEGS
*
TRX_SYS_RSEG_SLOT_SIZE
+
TRX_SYS_RSEG_SPACE
),
(
UNIV_PAGE_SIZE
-
FIL_PAGE_DATA_END
-
(
TRX_SYS_RSEGS
+
TRX_SYS_N_RSEGS
*
TRX_SYS_RSEG_SLOT_SIZE
+
TRX_SYS_RSEG_SPACE
))
+
page
-
sys_header
);
/* Create the first rollback segment in the SYSTEM tablespace */
page_no
=
trx_rseg_header_create
(
TRX_SYS_SPACE
,
ULINT_MAX
,
&
slot_no
,
...
...
ut/ut0mem.c
View file @
3366420b
...
...
@@ -162,6 +162,8 @@ retry:
#endif
}
UNIV_MEM_ALLOC
(
ret
,
n
+
sizeof
(
ut_mem_block_t
));
((
ut_mem_block_t
*
)
ret
)
->
size
=
n
+
sizeof
(
ut_mem_block_t
);
((
ut_mem_block_t
*
)
ret
)
->
magic_n
=
UT_MEM_MAGIC_N
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment