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
d384f11e
Commit
d384f11e
authored
Sep 19, 2014
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a maximum for pre-allocated objects
parent
e8563b27
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
libcaf_core/caf/detail/memory.hpp
libcaf_core/caf/detail/memory.hpp
+3
-1
No files found.
libcaf_core/caf/detail/memory.hpp
View file @
d384f11e
...
...
@@ -41,6 +41,7 @@ namespace {
constexpr
size_t
s_alloc_size
=
1024
*
1024
;
// allocate ~1mb chunks
constexpr
size_t
s_cache_size
=
10
*
1024
*
1024
;
// cache about 10mb per thread
constexpr
size_t
s_min_elements
=
5
;
// don't create < 5 elements
constexpr
size_t
s_max_elements
=
20
;
// don't create > 20 elements
}
// namespace <anonymous>
...
...
@@ -112,7 +113,8 @@ template <class T>
class
basic_memory_cache
:
public
memory_cache
{
static
constexpr
size_t
ne
=
s_alloc_size
/
sizeof
(
T
);
static
constexpr
size_t
dsize
=
ne
>
s_min_elements
?
ne
:
s_min_elements
;
static
constexpr
size_t
ms
=
ne
<
s_min_elements
?
s_min_elements
:
ne
;
static
constexpr
size_t
dsize
=
ms
>
s_max_elements
?
s_max_elements
:
ms
;
struct
wrapper
:
instance_wrapper
{
ref_counted
*
parent
;
...
...
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