morningman commented on a change in pull request #6979: URL: https://github.com/apache/incubator-doris/pull/6979#discussion_r742504948
########## File path: be/src/util/mem_info.cpp ########## @@ -80,10 +82,14 @@ void MemInfo::init() { } LOG(INFO) << "Physical Memory: " << PrettyPrinter::print(_s_physical_mem, TUnit::BYTES); - _s_initialized = true; } +int64_t MemInfo::mem_limit() { + bool is_percent = true; + return ParseUtil::parse_mem_spec(config::mem_limit, -1, MemInfo::physical_mem(), &is_percent); Review comment: The ParseUtil::parse_mem_spec() should not be called every time we call `mem_limit()` ########## File path: be/src/util/mem_info.h ########## @@ -39,6 +41,20 @@ class MemInfo { return _s_physical_mem; } + static inline int64_t current_mem() { + size_t allocated_bytes = 0; Review comment: This value should be updated in period, rather than get it every time we call `current_mem()`. `GetNumericProperty()` seems not a very-slight function call. https://github.com/gperftools/gperftools/blob/f7c6fb6c8e99d6b1b725e5994373bcd19ffdf8fd/src/tcmalloc.cc#L700 -- 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