Uploaded image for project: 'Pig'
  1. Pig
  2. PIG-1443

DefaultTuple underestimate the memory footprint for string

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.7.0
    • 0.7.0
    • impl
    • None
    • Reviewed

    Description

      Currently, in DefaultTuple, we estimate the memory footprint for string as if it is char array. The formula we use is: length * 2 + 12. It turns out we underestimate the memory usage for string. Here is a list of real memory footprint for string we get from memory dump:

      length of string memory in bytes
      7 56
      3 48
      1 40

      I did a search and find the following formula can accurately estimate the memory footprint for string:

      8 * (int) (((length * 2) + 45) / 8) 
      

      Attachments

        1. PIG-1443-1.patch
          6 kB
          Daniel Dai
        2. PIG-1443-2.patch
          6 kB
          Daniel Dai

        Activity

          People

            daijy Daniel Dai
            daijy Daniel Dai
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: