Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
7e6b7df8
Commit
7e6b7df8
authored
Mar 24, 2017
by
Craig Tiller
Committed by
GitHub
Mar 24, 2017
Browse files
Options
Downloads
Plain Diff
Merge pull request #10275 from ctiller/memory
Memory usage tweaks
parents
ac4a7283
b64d6527
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/core/lib/surface/channel.c
+7
-1
7 additions, 1 deletion
src/core/lib/surface/channel.c
test/core/memory_usage/client.c
+5
-0
5 additions, 0 deletions
test/core/memory_usage/client.c
with
12 additions
and
1 deletion
src/core/lib/surface/channel.c
+
7
−
1
View file @
7e6b7df8
...
@@ -194,8 +194,14 @@ grpc_channel *grpc_channel_create(grpc_exec_ctx *exec_ctx, const char *target,
...
@@ -194,8 +194,14 @@ grpc_channel *grpc_channel_create(grpc_exec_ctx *exec_ctx, const char *target,
size_t
grpc_channel_get_call_size_estimate
(
grpc_channel
*
channel
)
{
size_t
grpc_channel_get_call_size_estimate
(
grpc_channel
*
channel
)
{
#define ROUND_UP_SIZE 256
#define ROUND_UP_SIZE 256
/* We round up our current estimate to the NEXT value of ROUND_UP_SIZE.
This ensures:
1. a consistent size allocation when our estimate is drifting slowly
(which is common) - which tends to help most allocators reuse memory
2. a small amount of allowed growth over the estimate without hitting
the arena size doubling case, reducing overall memory usage */
return
((
size_t
)
gpr_atm_no_barrier_load
(
&
channel
->
call_size_estimate
)
+
return
((
size_t
)
gpr_atm_no_barrier_load
(
&
channel
->
call_size_estimate
)
+
ROUND_UP_SIZE
)
&
2
*
ROUND_UP_SIZE
)
&
~
(
size_t
)(
ROUND_UP_SIZE
-
1
);
~
(
size_t
)(
ROUND_UP_SIZE
-
1
);
}
}
...
...
This diff is collapsed.
Click to expand it.
test/core/memory_usage/client.c
+
5
−
0
View file @
7e6b7df8
...
@@ -237,6 +237,11 @@ int main(int argc, char **argv) {
...
@@ -237,6 +237,11 @@ int main(int argc, char **argv) {
0
,
grpc_slice_from_static_string
(
"Reflector/GetAfterSvrCreation"
));
0
,
grpc_slice_from_static_string
(
"Reflector/GetAfterSvrCreation"
));
// warmup period
// warmup period
for
(
int
i
=
0
;
i
<
warmup_iterations
;
i
++
)
{
send_snapshot_request
(
0
,
grpc_slice_from_static_string
(
"Reflector/SimpleSnapshot"
));
}
for
(
call_idx
=
0
;
call_idx
<
warmup_iterations
;
++
call_idx
)
{
for
(
call_idx
=
0
;
call_idx
<
warmup_iterations
;
++
call_idx
)
{
init_ping_pong_request
(
call_idx
+
1
);
init_ping_pong_request
(
call_idx
+
1
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment