Commit dd6e60fd authored by TousakaRin's avatar TousakaRin

Fixed a memory leak in Server::_cl when the server repeatedly started

parent 2fb608cc
...@@ -872,16 +872,15 @@ int Server::StartInternal(const butil::ip_t& ip, ...@@ -872,16 +872,15 @@ int Server::StartInternal(const butil::ip_t& ip,
bthread_setconcurrency(_options.num_threads); bthread_setconcurrency(_options.num_threads);
} }
if (NULL != _cl) {
_cl->Destroy();
_cl = NULL;
}
if (_options.max_concurrency != "constant" || if (_options.max_concurrency != "constant" ||
static_cast<int>(_options.max_concurrency) != 0) { static_cast<int>(_options.max_concurrency) != 0) {
_cl = ConcurrencyLimiter::CreateConcurrencyLimiterOrDie( _cl = ConcurrencyLimiter::CreateConcurrencyLimiterOrDie(
_options.max_concurrency); _options.max_concurrency);
_cl->Expose("Server_Concurrency_Limiter"); _cl->Expose("Server_Concurrency_Limiter");
} else {
if (_cl) {
_cl->Destroy();
}
_cl = NULL;
} }
for (MethodMap::iterator it = _method_map.begin(); for (MethodMap::iterator it = _method_map.begin();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment