diff --git a/README.md b/README.md index 55b6d3f1e..66d1882a6 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ If you want to avoid receiving data with missing fields during cleanup: This method is used to read the size of all the biggest data maps inside tdlib implementation. The output contains a string that can be parsed as a JSON. -## Other reccomended options +## Other recommended options * Options: * ignore_inline_thumbnails: true * disable_top_chats: true @@ -69,7 +69,7 @@ The output contains a string that can be parsed as a JSON. ----- -The following text is the classic tdlib readme: +The following text is the classic TDLib readme: # TDLib diff --git a/td/telegram/MemoryManager.cpp b/td/telegram/MemoryManager.cpp index 22e792085..059094951 100644 --- a/td/telegram/MemoryManager.cpp +++ b/td/telegram/MemoryManager.cpp @@ -103,13 +103,15 @@ bool MemoryManager::do_session_settings_allow_for_memory_management() { void MemoryManager::get_memory_stats(bool full, Promise promise) const { if (!can_manage_memory()) { - auto value = MemoryStats("{}"); + auto value = MemoryStats(R"({"warning": "OptimizeMemory is not enabled, please read the recommended options on README.md"})"); promise.set_value(std::move(value)); return; } - vector output = {"{\"memory_stats\":{"}; + vector output = {"{"}; + + output.push_back("\"memory_stats\":{"); output.push_back("\"messages_manager_\":{"); td_->messages_manager_->memory_stats(output); @@ -200,7 +202,9 @@ void MemoryManager::get_memory_stats(bool full, Promise promise) co td_->poll_manager_->memory_stats(output); output.push_back("}"); - output.push_back("}}"); + output.push_back("}"); + + output.push_back("}"); string s; s = accumulate(output.begin(), output.end(), s); diff --git a/td/telegram/MemoryManager.h b/td/telegram/MemoryManager.h index 9b49f6283..d568d9c17 100644 --- a/td/telegram/MemoryManager.h +++ b/td/telegram/MemoryManager.h @@ -39,7 +39,7 @@ class Td; struct MemoryStats { string debug; MemoryStats() = default; - explicit MemoryStats(string debug) : debug(debug) { + explicit MemoryStats(string debug) : debug(std::move(debug)) { } tl_object_ptr get_memory_statistics_object() const; };