Output the number of objects to be freed on closing.

This commit is contained in:
levlam 2022-04-25 20:52:44 +03:00
parent 641ee080c1
commit 17275fe422
8 changed files with 29 additions and 0 deletions

View File

@ -3317,6 +3317,11 @@ ContactsManager::~ContactsManager() = default;
void ContactsManager::tear_down() {
parent_.reset();
LOG(DEBUG) << "Have " << users_.size() << " users, " << chats_.size() << " basic groups, " << channels_.size()
<< " supergroups and " << secret_chats_.size() << " secret chats to free";
LOG(DEBUG) << "Have " << users_full_.size() << " full users, " << chats_full_.size() << " full basic groups and "
<< channels_full_.size() << " full supergroups to free";
}
UserId ContactsManager::load_my_id() {

View File

@ -13027,6 +13027,8 @@ class MessagesManager::DialogFiltersLogEvent {
void MessagesManager::tear_down() {
parent_.reset();
LOG(DEBUG) << "Have " << dialogs_.size() << " chats with " << added_message_count_ << " messages to free";
}
void MessagesManager::hangup() {
@ -16158,6 +16160,8 @@ void MessagesManager::on_message_deleted(Dialog *d, Message *m, bool is_permanen
if (m->notification_id.is_valid()) {
delete_notification_id_to_message_id_correspondence(d, m->notification_id, m->message_id);
}
added_message_count_--;
}
unique_ptr<MessagesManager::Message> MessagesManager::do_delete_scheduled_message(Dialog *d, MessageId message_id,
@ -34585,6 +34589,8 @@ MessagesManager::Message *MessagesManager::add_message_to_dialog(Dialog *d, uniq
}
}
added_message_count_++;
return result_message;
}

View File

@ -3417,6 +3417,7 @@ class MessagesManager final : public Actor {
bool running_get_difference_ = false; // true after before_get_difference and false after after_get_difference
FlatHashMap<DialogId, unique_ptr<Dialog>, DialogIdHash> dialogs_;
int64 added_message_count_ = 0;
FlatHashSet<DialogId, DialogIdHash> loaded_dialogs_; // dialogs loaded from database, but not added to dialogs_

View File

@ -177,6 +177,8 @@ UpdatesManager::UpdatesManager(Td *td, ActorShared<> parent) : td_(td), parent_(
void UpdatesManager::tear_down() {
parent_.reset();
LOG(DEBUG) << "Have " << being_processed_updates_ << " unprocessed updates to apply";
}
void UpdatesManager::hangup_shared() {
@ -1709,6 +1711,7 @@ void UpdatesManager::on_pending_updates(vector<tl_object_ptr<telegram_api::Updat
}
MultiPromiseActorSafe mpas{"OnPendingUpdatesMultiPromiseActor"};
being_processed_updates_++;
mpas.add_promise([actor_id = create_reference(), promise = std::move(promise)](Result<Unit> &&result) mutable {
send_closure(actor_id, &UpdatesManager::on_pending_updates_processed, std::move(result), std::move(promise));
});
@ -1831,6 +1834,7 @@ void UpdatesManager::on_pending_updates(vector<tl_object_ptr<telegram_api::Updat
}
void UpdatesManager::on_pending_updates_processed(Result<Unit> result, Promise<Unit> promise) {
being_processed_updates_--;
promise.set_result(std::move(result));
}

View File

@ -195,6 +195,8 @@ class UpdatesManager final : public Actor {
int32 pending_pts_ = 0;
int32 pending_qts_ = 0;
int64 being_processed_updates_ = 0;
int32 short_update_date_ = 0;
int32 accumulated_pts_count_ = 0;

View File

@ -413,6 +413,8 @@ WebPagesManager::WebPagesManager(Td *td, ActorShared<> parent) : td_(td), parent
void WebPagesManager::tear_down() {
parent_.reset();
LOG(DEBUG) << "Have " << web_pages_.size() << " web pages to free";
}
WebPagesManager::~WebPagesManager() = default;

View File

@ -3918,6 +3918,10 @@ void FileManager::hangup() {
void FileManager::tear_down() {
parent_.reset();
LOG(DEBUG) << "Have " << file_id_info_.size() << " files with " << file_nodes_.size() << " file nodes, "
<< local_location_to_file_id_.size() << " local locations and " << remote_location_info_.size()
<< " remote locations to free";
}
constexpr int64 FileManager::KEEP_DOWNLOAD_LIMIT;

View File

@ -37,6 +37,11 @@ class Enumerator {
return *arr_[pos];
}
size_t size() const {
CHECK(map_.size() == arr_.size());
return arr_.size();
}
private:
std::map<ValueT, int32> map_;
std::vector<const ValueT *> arr_;