Skip to content

tcn_ssl_ctxt_t alignment to avoid padding - #225

Closed
Scottmitch wants to merge 1 commit into
netty:masterfrom
Scottmitch:tcn_struct_padding
Closed

Scottmitch wants to merge 1 commit into
netty:masterfrom
Scottmitch:tcn_struct_padding

Conversation

@Scottmitch

Copy link
Copy Markdown
Member

Motivation:
tcn_ssl_ctxt_t is not properly aligned which may result in increased memory or additional padding inserted. Relying on the compiler optimization can be fragile and lead to inconsistencies between compilers.

Modifications:

  • Align internals of tcn_ssl_ctxt_t to be grouped in 64 byte chunks.

Result:
More proper memory alignment of the tcn_ssl_ctxt_t structure.

Motivation:
tcn_ssl_ctxt_t is not properly aligned which may result in increased memory or additional padding inserted. Relying on the compiler optimization can be fragile and lead to inconsistencies between compilers.

Modifications:
- Align internals of tcn_ssl_ctxt_t to be grouped in 64 byte chunks.

Result:
More proper memory alignment of the tcn_ssl_ctxt_t structure.
@Scottmitch Scottmitch mentioned this pull request Feb 3, 2017
@normanmaurer

Copy link
Copy Markdown
Member

@Scottmitch LGTM... that said I wonder if you want to add some comments about the size of the different fields and so make it easier to understand and so do the right thing when a new one is added

@Scottmitch

Copy link
Copy Markdown
Member Author

I think this is just a general consideration when modifying c structures. IMO it would be overkill to comment on every c structure about how alignment was done. When the fields are added/removed we should consider alignment/padding.

@Scottmitch

Copy link
Copy Markdown
Member Author

master (6756ffd)

@Scottmitch Scottmitch closed this Feb 3, 2017
@Scottmitch
Scottmitch deleted the tcn_struct_padding branch February 3, 2017 17:50
@normanmaurer normanmaurer added this to the 2.0.0.Final milestone Feb 3, 2017
@normanmaurer

Copy link
Copy Markdown
Member

@Scottmitch ok fair enough... I also set the milestone, please do next time ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants