Merge pull request #22201 from chrisse74/memoryLeakBuildAndStart

fix memory leak of grpc_resource_user_quota
pull/23468/head
Yash Tibrewal 4 years ago committed by GitHub
commit 50ec8b864d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      src/core/lib/surface/server.cc

@ -1600,13 +1600,6 @@ void grpc_server_shutdown_and_notify(grpc_server* server,
channel_broadcaster_shutdown(&broadcaster, true /* send_goaway */, channel_broadcaster_shutdown(&broadcaster, true /* send_goaway */,
GRPC_ERROR_NONE); GRPC_ERROR_NONE);
if (server->default_resource_user != nullptr) {
grpc_resource_quota_unref(
grpc_resource_user_quota(server->default_resource_user));
grpc_resource_user_shutdown(server->default_resource_user);
grpc_resource_user_unref(server->default_resource_user);
}
} }
void grpc_server_cancel_all_calls(grpc_server* server) { void grpc_server_cancel_all_calls(grpc_server* server) {
@ -1637,6 +1630,12 @@ void grpc_server_destroy(grpc_server* server) {
GPR_ASSERT(server->listeners_destroyed == server->listeners.size()); GPR_ASSERT(server->listeners_destroyed == server->listeners.size());
gpr_mu_unlock(&server->mu_global); gpr_mu_unlock(&server->mu_global);
if (server->default_resource_user != nullptr) {
grpc_resource_quota_unref(
grpc_resource_user_quota(server->default_resource_user));
grpc_resource_user_shutdown(server->default_resource_user);
grpc_resource_user_unref(server->default_resource_user);
}
server_unref(server); server_unref(server);
} }

Loading…
Cancel
Save