Don't allocate slice buffers when using the zero copy protector, as they are entirely unused. (#29392)

pull/29401/head
dpcollins-google 3 years ago committed by GitHub
parent 25bade9be5
commit fc077c2771
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      src/core/lib/security/transport/secure_endpoint.cc

@ -72,10 +72,15 @@ struct secure_endpoint {
->CreateMemoryOwner(absl::StrCat(grpc_endpoint_get_peer(transport),
":secure_endpoint"));
self_reservation = memory_owner.MakeReservation(sizeof(*this));
read_staging_buffer =
memory_owner.MakeSlice(grpc_core::MemoryRequest(STAGING_BUFFER_SIZE));
write_staging_buffer =
memory_owner.MakeSlice(grpc_core::MemoryRequest(STAGING_BUFFER_SIZE));
if (zero_copy_protector) {
read_staging_buffer = grpc_empty_slice();
write_staging_buffer = grpc_empty_slice();
} else {
read_staging_buffer =
memory_owner.MakeSlice(grpc_core::MemoryRequest(STAGING_BUFFER_SIZE));
write_staging_buffer =
memory_owner.MakeSlice(grpc_core::MemoryRequest(STAGING_BUFFER_SIZE));
}
has_posted_reclaimer.store(false, std::memory_order_relaxed);
gpr_ref_init(&ref, 1);
}

Loading…
Cancel
Save