[jira] [Commented] (PROTON-585) Can improve memory use by rearranging structs to eliminate padding
[ https://issues.apache.org/jira/browse/PROTON-585?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14005981#comment-14005981 ] Andrew Stitcher commented on PROTON-585: There is a very useful tool pahole (part of the dwarves package under Fedora) which will inspect the debug info in a library or executable and tell you about structure packing and padding. Can improve memory use by rearranging structs to eliminate padding -- Key: PROTON-585 URL: https://issues.apache.org/jira/browse/PROTON-585 Project: Qpid Proton Issue Type: Improvement Components: proton-c Affects Versions: 0.6, 0.7 Reporter: Andrew Stitcher Assignee: Andrew Stitcher Priority: Minor 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. -- This message was sent by Atlassian JIRA (v6.2#6252)
[jira] [Commented] (PROTON-585) Can improve memory use by rearranging structs to eliminate padding
[ https://issues.apache.org/jira/browse/PROTON-585?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14006093#comment-14006093 ] ASF subversion and git services commented on PROTON-585: Commit 1596912 from [~astitcher] in branch 'proton/trunk' [ https://svn.apache.org/r1596912 ] PROTON-585: Rearrange structures (where possible) to remove padding holes Can improve memory use by rearranging structs to eliminate padding -- Key: PROTON-585 URL: https://issues.apache.org/jira/browse/PROTON-585 Project: Qpid Proton Issue Type: Improvement Components: proton-c Affects Versions: 0.6, 0.7 Reporter: Andrew Stitcher Assignee: Andrew Stitcher Priority: Minor 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. -- This message was sent by Atlassian JIRA (v6.2#6252)