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
0e4fa3e6
Commit
0e4fa3e6
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
e771b066
Changes
1
Show 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 @
0e4fa3e6
...
...
@@ -272,13 +272,19 @@ void range_buffer::append_point(const DBT *key) {
}
void
range_buffer
::
maybe_grow
(
size_t
size
)
{
static
const
size_t
initial_size
=
4096
;
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,
// but only additivately increase the size after that.
if
(
m_buf_size
<
aggressive_growth_threshold
)
{
m_buf_size
=
m_buf_size
?
m_buf_size
*
2
:
get_initial_size
(
size
);
}
else
{
while
(
m_buf_size
<
needed
&&
m_buf_size
<
aggressive_growth_threshold
)
{
m_buf_size
<<=
1
;
}
while
(
m_buf_size
<
needed
)
{
m_buf_size
+=
aggressive_growth_threshold
;
}
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