xinyiZzz commented on a change in pull request #6979:
URL: https://github.com/apache/incubator-doris/pull/6979#discussion_r748078661
##########
File path: be/src/service/doris_main.cpp
##########
@@ -266,6 +266,10 @@ int main(int argc, char** argv) {
#if defined(LEAK_SANITIZER)
__lsan_do_leak_check();
#endif
+
+#if !defined(ADDRESS_SANITIZER) && !defined(LEAK_SANITIZER) &&
!defined(THREAD_SANITIZER)
+ doris::MemInfo::refresh_current_mem();
+#endif
sleep(10);
Review comment:
10s is too long.
When I optimize the memory allocation later, I plan to manually call it in
other places such as HashTable / ChunkAllocator.
##########
File path: be/src/runtime/mem_tracker.h
##########
@@ -164,11 +167,16 @@ class MemTracker : public
std::enable_shared_from_this<MemTracker> {
/// other callers that may not tolerate allocation failures have a better
chance
/// of success. Returns true if the consumption was successfully updated.
WARN_UNUSED_RESULT
- bool TryConsume(int64_t bytes, MemLimit mode = MemLimit::HARD) {
+ Status TryConsume(int64_t bytes, MemLimit mode = MemLimit::HARD) {
// DCHECK_GE(bytes, 0);
if (bytes <= 0) {
Release(-bytes);
- return true;
+ return Status::OK();
+ }
+ if (MemInfo::current_mem() + bytes >= MemInfo::mem_limit()) {
+ return Status::MemoryLimitExceeded(fmt::format(
+ "{}: TryConsume failed, bytes={} process whole
consumption={} mem limit={}",
+ label_, bytes, MemInfo::current_mem(),
MemInfo::mem_limit()));
Review comment:
Printing MemTracker::MemLimitExceeded has a certain cost, confirm that
it will not be printed frequently.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]