Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
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
Operations
Operations
Metrics
Environments
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
cpp-libs
Actor Framework
Commits
7dd87b94
Commit
7dd87b94
authored
Jan 16, 2021
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reclaim only small and medium buckets
parent
adfb5902
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
4 deletions
+12
-4
libcaf_core/src/detail/monotonic_buffer_resource.cpp
libcaf_core/src/detail/monotonic_buffer_resource.cpp
+12
-4
No files found.
libcaf_core/src/detail/monotonic_buffer_resource.cpp
View file @
7dd87b94
...
@@ -29,17 +29,25 @@ void monotonic_buffer_resource::release() {
...
@@ -29,17 +29,25 @@ void monotonic_buffer_resource::release() {
reset
(
small_
);
reset
(
small_
);
release
(
medium_
);
release
(
medium_
);
reset
(
medium_
);
reset
(
medium_
);
for
(
auto
&
kvp
:
var_
)
{
for
(
auto
&
kvp
:
var_
)
release
(
kvp
.
second
);
release
(
kvp
.
second
);
reset
(
kvp
.
second
);
var_
.
clear
();
}
}
}
void
monotonic_buffer_resource
::
reclaim
()
{
void
monotonic_buffer_resource
::
reclaim
()
{
// Only reclaim the small and medium buffers. They have a high chance of
// actually reducing future heap allocations. Because of the relatively small
// bucket sizes, the variable buckets have a higher change of not producing
// 'hits' in future runs. We can get smarter about managing larger
// allocations, but ultimately this custom memory resource implementation is a
// placeholder until we can use the new `std::pmr` utilities. So as long as
// performance is "good enough", we keep our implementation simple and err on
// the side of caution for now.
reclaim
(
small_
);
reclaim
(
small_
);
reclaim
(
medium_
);
reclaim
(
medium_
);
for
(
auto
&
kvp
:
var_
)
for
(
auto
&
kvp
:
var_
)
reclaim
(
kvp
.
second
);
release
(
kvp
.
second
);
var_
.
clear
();
}
}
void
*
monotonic_buffer_resource
::
allocate
(
size_t
bytes
,
size_t
alignment
)
{
void
*
monotonic_buffer_resource
::
allocate
(
size_t
bytes
,
size_t
alignment
)
{
...
...
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