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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
dc28b6d1
Commit
dc28b6d1
authored
7 years ago
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve ASAN instrumentation: MEM_ROOT
more complete TRASH-ing of memroots
parent
a966d422
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
mysys/my_alloc.c
mysys/my_alloc.c
+6
-3
No files found.
mysys/my_alloc.c
View file @
dc28b6d1
...
@@ -22,6 +22,8 @@
...
@@ -22,6 +22,8 @@
#undef EXTRA_DEBUG
#undef EXTRA_DEBUG
#define EXTRA_DEBUG
#define EXTRA_DEBUG
#define TRASH_MEM(X) TRASH_FREE(((char*)(X) + ((X)->size-(X)->left)), (X)->left)
/*
/*
Initialize memory root
Initialize memory root
...
@@ -60,12 +62,13 @@ void init_alloc_root(MEM_ROOT *mem_root, size_t block_size,
...
@@ -60,12 +62,13 @@ void init_alloc_root(MEM_ROOT *mem_root, size_t block_size,
if
(
pre_alloc_size
)
if
(
pre_alloc_size
)
{
{
if
((
mem_root
->
free
=
mem_root
->
pre_alloc
=
if
((
mem_root
->
free
=
mem_root
->
pre_alloc
=
(
USED_MEM
*
)
my_malloc
(
pre_alloc_size
+
ALIGN_SIZE
(
sizeof
(
USED_MEM
)),
(
USED_MEM
*
)
my_malloc
(
pre_alloc_size
+
ALIGN_SIZE
(
sizeof
(
USED_MEM
)),
MYF
(
0
))))
MYF
(
0
))))
{
{
mem_root
->
free
->
size
=
pre_alloc_size
+
ALIGN_SIZE
(
sizeof
(
USED_MEM
));
mem_root
->
free
->
size
=
pre_alloc_size
+
ALIGN_SIZE
(
sizeof
(
USED_MEM
));
mem_root
->
free
->
left
=
pre_alloc_size
;
mem_root
->
free
->
left
=
pre_alloc_size
;
mem_root
->
free
->
next
=
0
;
mem_root
->
free
->
next
=
0
;
TRASH_MEM
(
mem_root
->
free
);
}
}
}
}
#endif
#endif
...
@@ -132,6 +135,7 @@ void reset_root_defaults(MEM_ROOT *mem_root, size_t block_size,
...
@@ -132,6 +135,7 @@ void reset_root_defaults(MEM_ROOT *mem_root, size_t block_size,
mem
->
left
=
pre_alloc_size
;
mem
->
left
=
pre_alloc_size
;
mem
->
next
=
*
prev
;
mem
->
next
=
*
prev
;
*
prev
=
mem_root
->
pre_alloc
=
mem
;
*
prev
=
mem_root
->
pre_alloc
=
mem
;
TRASH_MEM
(
mem
);
}
}
else
else
{
{
...
@@ -225,6 +229,7 @@ void *alloc_root(MEM_ROOT *mem_root, size_t length)
...
@@ -225,6 +229,7 @@ void *alloc_root(MEM_ROOT *mem_root, size_t length)
next
->
size
=
get_size
;
next
->
size
=
get_size
;
next
->
left
=
get_size
-
ALIGN_SIZE
(
sizeof
(
USED_MEM
));
next
->
left
=
get_size
-
ALIGN_SIZE
(
sizeof
(
USED_MEM
));
*
prev
=
next
;
*
prev
=
next
;
TRASH_MEM
(
next
);
}
}
point
=
(
uchar
*
)
((
char
*
)
next
+
(
next
->
size
-
next
->
left
));
point
=
(
uchar
*
)
((
char
*
)
next
+
(
next
->
size
-
next
->
left
));
...
@@ -293,8 +298,6 @@ void *multi_alloc_root(MEM_ROOT *root, ...)
...
@@ -293,8 +298,6 @@ void *multi_alloc_root(MEM_ROOT *root, ...)
DBUG_RETURN
((
void
*
)
start
);
DBUG_RETURN
((
void
*
)
start
);
}
}
#define TRASH_MEM(X) TRASH_FREE(((char*)(X) + ((X)->size-(X)->left)), (X)->left)
/* Mark all data in blocks free for reusage */
/* Mark all data in blocks free for reusage */
static
inline
void
mark_blocks_free
(
MEM_ROOT
*
root
)
static
inline
void
mark_blocks_free
(
MEM_ROOT
*
root
)
...
...
This diff is collapsed.
Click to expand it.
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