yiguolei commented on code in PR #40344: URL: https://github.com/apache/doris/pull/40344#discussion_r1743150517
########## be/src/common/daemon.cpp: ########## @@ -396,6 +472,34 @@ void Daemon::je_purge_dirty_pages_thread() const { } while (true); } +void Daemon::cache_adjust_capacity_thread() { + std::unique_ptr<RuntimeProfile> profile = std::make_unique<RuntimeProfile>(""); + do { + std::unique_lock<std::mutex> l(doris::GlobalMemoryArbitrator::cache_adjust_capacity_lock); + while (_stop_background_threads_latch.count() != 0 && + !doris::GlobalMemoryArbitrator::cache_adjust_capacity_notify.load( + std::memory_order_relaxed)) { + doris::GlobalMemoryArbitrator::cache_adjust_capacity_cv.wait_for( + l, std::chrono::seconds(1)); + } + if (_stop_background_threads_latch.count() == 0) { + break; + } + if (config::disable_memory_gc) { + continue; + } + auto freed_mem = CacheManager::instance()->for_each_cache_refresh_capacity( + GlobalMemoryArbitrator::last_cache_capacity_adjust_weighted, profile.get()); Review Comment: 需要先把这个值保存下来,然后再传递给函数,防止在多个调用之间,这个值发生变化 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org