Uploaded image for project: 'IMPALA'
  1. IMPALA
  2. IMPALA-9291

MemTracker's TryConsume() should behave consistent with Consume()/Release()

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • Impala 3.4.0
    • None
    • None
    • ghx-label-14

    Description

      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:

       

      TryConsume(-42); // no-op, returns true which means SUCCESS
      Release(-42); // => Consume(42)
      

      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.

      Attachments

        Issue Links

          Activity

            People

              boroknagyz Zoltán Borók-Nagy
              boroknagyz Zoltán Borók-Nagy
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: