You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@impala.apache.org by "Zoltán Borók-Nagy (Jira)" <ji...@apache.org> on 2020/01/13 15:00:00 UTC

[jira] [Created] (IMPALA-9291) MemTracker's TryConsume() should behave consistent with Consume()/Release()

Zoltán Borók-Nagy created IMPALA-9291:
-----------------------------------------

             Summary: MemTracker's TryConsume() should behave consistent with Consume()/Release()
                 Key: IMPALA-9291
                 URL: https://issues.apache.org/jira/browse/IMPALA-9291
             Project: IMPALA
          Issue Type: Bug
            Reporter: Zoltán Borók-Nagy


Impala's MemTracker tracks allocated memory. MemTracker::Consume() is meant to be used in tandem with memory allocations and MemTracker::Release() is for de-allocations.

However, both supports negative values, in this case MemTracker::Consume(negative_val) will invoke MemTracker::Release(*-*negative_val), and vica versa.

On the other hand, TryConsume() is a no-op for values less than zero. This causes problems in the following scenario:

 
{noformat}
TryConsume(-42); // no-op, returns true which means SUCCESS
Release(-42); // => Consume(42)
{noformat}
Later when the mem tracker gets closed it will think there is 42 bytes of unallocated memory.

Either we shouldn't allow negative values in Consume()/TryConsume()/Release(), or TryConsume() should invoke Release() in this case instead of doing nothing.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)