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
5c4122d3
Commit
5c4122d3
authored
Apr 03, 2003
by
pem@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed the last memory leaks in the SP code.
parent
1fc3582b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
11 deletions
+21
-11
sql/sp.cc
sql/sp.cc
+4
-6
sql/sp_head.cc
sql/sp_head.cc
+6
-0
sql/sql_parse.cc
sql/sql_parse.cc
+11
-5
No files found.
sql/sp.cc
View file @
5c4122d3
...
...
@@ -373,13 +373,11 @@ sp_cache_functions(THD *thd, LEX *lex)
void
sp_clear_function_cache
(
THD
*
thd
)
{
//QQ This doesn't work for some completely mysterious reason, but since this
//QQ is tempoarary code anyway, we just ignore it for now.
//QQ List_iterator_fast<sp_head> li(thd->spfuns);
//QQ sp_head *sp;
List_iterator_fast
<
sp_head
>
li
(
thd
->
spfuns
);
sp_head
*
sp
;
//QQ
while ((sp= li++))
//QQ
sp->destroy();
while
((
sp
=
li
++
))
sp
->
destroy
();
thd
->
spfuns
.
empty
();
}
...
...
sql/sp_head.cc
View file @
5c4122d3
...
...
@@ -94,8 +94,10 @@ eval_func_item(THD *thd, Item *it, enum enum_field_types type)
sp_head
::
sp_head
(
LEX_STRING
*
name
,
LEX
*
lex
)
:
Sql_alloc
(),
m_simple_case
(
FALSE
)
{
DBUG_ENTER
(
"sp_head::sp_head"
);
const
char
*
dstr
=
(
const
char
*
)
lex
->
buf
;
DBUG_PRINT
(
"info"
,
(
"name: %s"
,
name
->
str
));
m_name
.
length
=
name
->
length
;
m_name
.
str
=
name
->
str
;
m_defstr
.
length
=
lex
->
end_of_query
-
lex
->
buf
;
...
...
@@ -103,6 +105,7 @@ sp_head::sp_head(LEX_STRING *name, LEX *lex)
m_pcont
=
lex
->
spcont
;
my_init_dynamic_array
(
&
m_instr
,
sizeof
(
sp_instr
*
),
16
,
8
);
m_backpatch
.
empty
();
DBUG_VOID_RETURN
;
}
int
...
...
@@ -128,8 +131,11 @@ sp_head::create(THD *thd)
void
sp_head
::
destroy
()
{
DBUG_ENTER
(
"sp_head::destroy"
);
DBUG_PRINT
(
"info"
,
(
"name: %s"
,
m_name
.
str
));
delete_dynamic
(
&
m_instr
);
m_pcont
->
destroy
();
DBUG_VOID_RETURN
;
}
int
...
...
sql/sql_parse.cc
View file @
5c4122d3
...
...
@@ -1523,6 +1523,14 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
thread_running
--
;
VOID
(
pthread_mutex_unlock
(
&
LOCK_thread_count
));
thd
->
packet
.
shrink
(
thd
->
variables
.
net_buffer_length
);
// Reclaim some memory
/*
Clear the SP function cache after each statement (QQ this is a temporary
solution; caching will be rehacked later).
Note: Must do this before we free_root.
*/
sp_clear_function_cache
(
thd
);
free_root
(
&
thd
->
mem_root
,
MYF
(
MY_KEEP_PREALLOC
));
DBUG_RETURN
(
error
);
}
...
...
@@ -1587,11 +1595,6 @@ mysql_execute_command(THD *thd)
SELECT_LEX_UNIT
*
unit
=
&
lex
->
unit
;
DBUG_ENTER
(
"mysql_execute_command"
);
/*
Clear the SP function cache before each statement (QQ this is a temporary
solution; caching will be rehacked later), and the new ones.
*/
sp_clear_function_cache
(
thd
);
if
(
lex
->
sql_command
!=
SQLCOM_CREATE_PROCEDURE
&&
lex
->
sql_command
!=
SQLCOM_CREATE_SPFUNCTION
)
{
...
...
@@ -3009,6 +3012,9 @@ mysql_execute_command(THD *thd)
}
#endif
res
=
lex
->
sphead
->
create
(
thd
);
lex
->
sphead
->
destroy
();
// QQ Free memory. Remove this when caching!!!
switch
(
res
)
{
case
SP_OK
:
...
...
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