xinyiZzz commented on a change in pull request #6979:
URL: https://github.com/apache/incubator-doris/pull/6979#discussion_r748086231
##########
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]