Skip to content

Commit

Permalink
Always use 128 client threads (todo: make this behavior optional)
Browse files Browse the repository at this point in the history
This change fixes some memory management issues
  • Loading branch information
cavallium committed Feb 19, 2024
1 parent 640a668 commit d0014b1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions td/telegram/Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -435,8 +435,17 @@ class MultiImplPool {
#if TD_OPENBSD
max_client_threads = td::min(max_client_threads, 4u);
#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);
// Start TDLight - disable check
# if false
// End TDLight - disable check
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>();
}
Expand Down

0 comments on commit d0014b1

Please sign in to comment.