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
1282eb69
Commit
1282eb69
authored
Dec 11, 2016
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup: make malloc_size_cb_func always defined
parent
ebb8c9fb
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
10 deletions
+10
-10
mysys/my_malloc.c
mysys/my_malloc.c
+8
-7
sql/mysqld.cc
sql/mysqld.cc
+2
-3
No files found.
mysys/my_malloc.c
View file @
1282eb69
...
...
@@ -48,7 +48,6 @@ static inline size_t malloc_size_and_flag(void *p, my_bool *is_thread_specific)
#define MALLOC_FIX_POINTER_FOR_FREE(p) (((char*) (p)) - MALLOC_PREFIX_SIZE)
#endif
/* SAFEMALLOC */
static
MALLOC_SIZE_CB
malloc_size_cb_func
=
NULL
;
/**
Inform application that memory usage has changed
...
...
@@ -59,17 +58,19 @@ static MALLOC_SIZE_CB malloc_size_cb_func= NULL;
The type os size is long long, to be able to handle negative numbers to
decrement the memory usage
@return 0 - ok
1 - failure, abort the allocation
*/
static
void
dummy
(
long
long
size
__attribute__
((
unused
)),
my_bool
is_thread_specific
__attribute__
((
unused
)))
{}
static
void
update_malloc_size
(
long
long
size
,
my_bool
is_thread_specific
)
{
if
(
malloc_size_cb_func
)
malloc_size_cb_func
(
size
,
is_thread_specific
);
}
static
MALLOC_SIZE_CB
update_malloc_size
=
dummy
;
void
set_malloc_size_cb
(
MALLOC_SIZE_CB
func
)
{
malloc_size_cb_func
=
func
;
update_malloc_size
=
func
?
func
:
dummy
;
}
...
...
sql/mysqld.cc
View file @
1282eb69
...
...
@@ -3989,7 +3989,7 @@ static void my_malloc_size_cb_func(long long size, my_bool is_thread_specific)
{
THD
*
thd
=
current_thd
;
if
(
likely
(
is_thread_specific
)
)
/* If thread specific memory */
if
(
is_thread_specific
)
/* If thread specific memory */
{
/*
When thread specfic is set, both mysqld_server_initialized and thd
...
...
@@ -4006,8 +4006,7 @@ static void my_malloc_size_cb_func(long long size, my_bool is_thread_specific)
else
if
(
likely
(
thd
))
{
DBUG_PRINT
(
"info"
,
(
"global thd memory_used: %lld size: %lld"
,
(
longlong
)
thd
->
status_var
.
global_memory_used
,
size
));
(
longlong
)
thd
->
status_var
.
global_memory_used
,
size
));
thd
->
status_var
.
global_memory_used
+=
size
;
}
else
...
...
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