Uploaded image for project: 'Qpid Proton'
  1. Qpid Proton
  2. PROTON-585

Can improve memory use by rearranging structs to eliminate padding

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • proton-0.6, proton-0.7
    • proton-0.8
    • proton-c
    • None

    Description

      The C/C++ language rules allow compilers to add extra padding in the middle of structs .Generally this is done to maintain the correct ABI alignment for the members.

      This means that by paying attention to the sizes of the members you can eliminate the padding simply by putting the largest members (with the biggest alignment constraint) first then the next then the next down to bitfields (if you are using them).

      Removing the padding can reduce the space used by structs and this can be significant if enough of them are allocated.

      Attachments

        Activity

          People

            astitcher Andrew Stitcher
            astitcher Andrew Stitcher
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: