Always use 128 client threads (todo: make this behavior optional)

This change fixes some memory management issues
This commit is contained in:
Andrea Cavalli 2024-02-14 01:56:30 +01:00
parent 2343bb9350
commit 377b97ba9a

View File

@ -435,8 +435,17 @@ class MultiImplPool {
#if TD_OPENBSD #if TD_OPENBSD
max_client_threads = td::min(max_client_threads, 4u); max_client_threads = td::min(max_client_threads, 4u);
#endif #endif
// Start TDLight - increment this to 128, otherwise the memory will not be freed when a session is closed
max_client_threads = 128;
// End TDLight - increment this to 128, otherwise the memory will not be freed when a session is closed
impls_.resize(max_client_threads); impls_.resize(max_client_threads);
// Start TDLight - disable check
# if false
// End TDLight - disable check
CHECK(impls_.size() * (1 + MultiImpl::ADDITIONAL_THREAD_COUNT + 1 /* IOCP */) < 128); CHECK(impls_.size() * (1 + MultiImpl::ADDITIONAL_THREAD_COUNT + 1 /* IOCP */) < 128);
// Start TDLight - disable check
# endif
// End TDLight - disable check
net_query_stats_ = std::make_shared<NetQueryStats>(); net_query_stats_ = std::make_shared<NetQueryStats>();
} }