More memory cleanups

This commit is contained in:
Andrea Cavalli 2020-05-17 00:36:28 +02:00
parent 7806bcec3c
commit a932cc53fe
5 changed files with 12 additions and 0 deletions

View File

@ -5026,6 +5026,8 @@ void Td::on_request(uint64 id, td_api::optimizeStorage &request) {
web_pages_manager_->memory_cleanup();
stickers_manager_->memory_cleanup();
documents_manager_->memory_cleanup();
video_notes_manager_->memory_cleanup();
videos_manager_->memory_cleanup();
file_manager_->memory_cleanup();
std::vector<FileType> file_types;

View File

@ -26,6 +26,8 @@ class VideoNotesManager {
public:
explicit VideoNotesManager(Td *td);
void memory_cleanup();
int32 get_video_note_duration(FileId file_id) const;
tl_object_ptr<td_api::videoNote> get_video_note_object(FileId file_id);

View File

@ -46,5 +46,8 @@ FileId VideoNotesManager::parse_video_note(ParserT &parser) {
}
return on_get_video_note(std::move(video_note), false);
}
void VideoNotesManager::memory_cleanup() {
video_notes_.clear();
}
} // namespace td

View File

@ -300,5 +300,8 @@ string VideosManager::get_video_search_text(FileId file_id) const {
CHECK(video != nullptr);
return video->file_name;
}
void VideosManager::memory_cleanup() {
videos_.clear();
}
} // namespace td

View File

@ -26,6 +26,8 @@ class VideosManager {
public:
explicit VideosManager(Td *td);
void memory_cleanup();
int32 get_video_duration(FileId file_id) const;
tl_object_ptr<td_api::video> get_video_object(FileId file_id);