diff --git a/README.md b/README.md index 05a63f66d..a99632954 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,9 @@ TDLight is 100% compatible with tdlib, if you don't use the sqlite database. TDLight can clean itself and release some ram to the OS if you want. Look at **TdApi.OptimizeMemory** in "Modified features" paragraph to see how. ### Constant memory usage TDLight if used with care doesn't grow in memory usage with time. Look at **TdApi.OptimizeMemory** in "Modified features" paragraph to see how + +![memory usage](info/memory-usage.jpg) + ### Custom options We added some options: * **disable_minithumbnails** (true/false) This setting removes minithumbnails everywhere. It reduces memory usage because tdlib keeps them in RAM. diff --git a/info/memory-usage.jpg b/info/memory-usage.jpg new file mode 100644 index 000000000..4d3dc9dfc Binary files /dev/null and b/info/memory-usage.jpg differ diff --git a/td/telegram/MemoryManager.cpp b/td/telegram/MemoryManager.cpp index 0b93950cd..797fc4c3a 100644 --- a/td/telegram/MemoryManager.cpp +++ b/td/telegram/MemoryManager.cpp @@ -178,7 +178,9 @@ void MemoryManager::clean_memory(bool full, Promise promise) const { td_->file_manager_->memory_cleanup(); #ifdef __linux__ - malloc_trim(0); + #if defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(__MUSL__) + malloc_trim(0); + #endif #endif promise.set_value(Unit());