]> git.kaiwu.me - haproxy.git/commit
MINOR: activity: use dynamic allocation for "show profiling" entries
authorWilly Tarreau <w@1wt.eu>
Wed, 11 Mar 2026 14:22:24 +0000 (15:22 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 12 Mar 2026 17:06:37 +0000 (18:06 +0100)
commit01457979b685b10d4102b47400b7edf7fd2548c8
treecb93f680700ed0f74ff0e9c7a293ba014f9b63ec
parent07655da068404075ad8cb1b56a03c8288c1d36c4
MINOR: activity: use dynamic allocation for "show profiling" entries

Historically, the data manipulated by "show profiling" were copied
onto the stack for sorting and aggregating, but not only this limits
the number of entries we can keep, but it also has an impact on CPU
usage (having to redo the whole copy+sort upon each resume) and the
output accuracy (if sorting changes lines, resume may happen from an
incorrect one).

Instead, let's dynamically allocate the work buffer and place it into
the service context. We only allocate it immediately before needing it
and release it immediately afterwards so that it doesn't stay long. It
also requires a release handler to release those allocates by interrupted
dumps, but that's all. The overall result is now much cleaner, more
accurate, faster and safer.

This patch may be backported to older LTS releases.
src/activity.c