yiguolei commented on code in PR #21522: URL: https://github.com/apache/doris/pull/21522#discussion_r1253295314
########## be/src/util/mem_info.h: ########## @@ -165,9 +172,162 @@ class MemInfo { static std::string debug_string(); - static void process_cache_gc(int64_t& freed_mem); - static bool process_minor_gc(); - static bool process_full_gc(); + template <typename Func, typename... Args> + static void gc_wrap(Func&& gc_func, const std::string& name, int64_t& freed_mem, + std::unordered_map<std::string, int64_t>& freed_details, + std::unordered_map<std::string, uint64_t>& cost_details, Args&&... args) { + MonotonicStopWatch watch; + watch.start(); + freed_details[name] = gc_func(freed_mem, std::forward<Args>(args)...); + freed_mem += freed_details[name]; + cost_details[name] = watch.elapsed_time() / 1000; + } + + static std::string print_gc_freed_details( + std::unordered_map<std::string, int64_t>& freed_details, + std::unordered_map<std::string, uint64_t>& cost_details); + + // step1: free all cache + // step2: free resource groups memory that enable overcommit + // step3: free global top overcommit query, if enable query memory overcommit + // TODO Now, the meaning is different from java minor gc + full gc, more like small gc + large gc. + template <typename... Args> 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