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
ae87b251
Commit
ae87b251
authored
Sep 17, 2013
by
John Esmet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed memory allocation error in range_buffer #70
fixes #70
parent
50aef9b7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
locktree/range_buffer.cc
locktree/range_buffer.cc
+10
-4
No files found.
locktree/range_buffer.cc
View file @
ae87b251
...
@@ -272,13 +272,19 @@ void range_buffer::append_point(const DBT *key) {
...
@@ -272,13 +272,19 @@ void range_buffer::append_point(const DBT *key) {
}
}
void
range_buffer
::
maybe_grow
(
size_t
size
)
{
void
range_buffer
::
maybe_grow
(
size_t
size
)
{
static
const
size_t
initial_size
=
4096
;
static
const
size_t
aggressive_growth_threshold
=
128
*
1024
;
static
const
size_t
aggressive_growth_threshold
=
128
*
1024
;
if
(
m_buf_current
+
size
>
m_buf_size
)
{
const
size_t
needed
=
m_buf_current
+
size
;
if
(
m_buf_size
<
needed
)
{
if
(
m_buf_size
==
0
)
{
m_buf_size
=
initial_size
;
}
// aggressively grow the range buffer to the threshold,
// aggressively grow the range buffer to the threshold,
// but only additivately increase the size after that.
// but only additivately increase the size after that.
if
(
m_buf_size
<
aggressive_growth_threshold
)
{
while
(
m_buf_size
<
needed
&&
m_buf_size
<
aggressive_growth_threshold
)
{
m_buf_size
=
m_buf_size
?
m_buf_size
*
2
:
get_initial_size
(
size
);
m_buf_size
<<=
1
;
}
else
{
}
while
(
m_buf_size
<
needed
)
{
m_buf_size
+=
aggressive_growth_threshold
;
m_buf_size
+=
aggressive_growth_threshold
;
}
}
XREALLOC
(
m_buf
,
m_buf_size
);
XREALLOC
(
m_buf
,
m_buf_size
);
...
...
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