Skip to content

Conversation

@bazsi
Copy link
Member

@bazsi bazsi commented Jan 24, 2026

This is a followup to #889 and #891 containing the message shrinking part. Only to be considered when those other two are merged.

bazsi added 8 commits January 30, 2026 09:03
Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
This functionality is going to be refactored into a more elaborate algorithm
to resize an NVTable, assuming a new storage needed.  To be used both from
nv_table_clone() and nv_table_resize(), in a next patch.

Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
Whenever NVTable needs to grow (either during clone or realloc), the new
nv_table_get_next_size() function calculates the right new size, while
ensuring some "additional_space" becomes available in the new clone.

Previously, we always erred on the side of increasing the allocation size,
so that any expected new changes would not need another bump of the size.
This algorithm however, can waste a lot of memory.

The new algorithm is:
  * increase at least 256 bytes,
  * only increase the size if the current allocation does not fit
  * use 4k aligned sizes for large NVTables (>4kB) or 1k for small ones

We might have slightly more reallocs this way, but the total allocation of a
LogMessage should be a lot less.

Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
…e_realloc()

Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
…() function

We do not support cases where these would point to different instances, so
reduce redundancy by using a single in/out pointer.

Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
In case our "payload" would be larger than 2kB, do not piggy back the
payload at the end of the LogMessage.

Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
…the queue

Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
@bazsi bazsi force-pushed the logmsg-shrink-payload-when-queued branch from cc9945c to 9ffbf97 Compare January 30, 2026 08:57
@MrAnno MrAnno requested review from alltilla and sodomelle February 4, 2026 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant