sd-event: allocate event source objects with the actually needed size
authorLennart Poettering <lennart@poettering.net>
Fri, 10 Feb 2023 16:56:48 +0000 (17:56 +0100)
committerLennart Poettering <lennart@poettering.net>
Fri, 17 Feb 2023 09:09:30 +0000 (10:09 +0100)
commita38cf9fb965552c932a18c6b1b7950aed521cbe5
treefb000b9ccd751c0d6f289df978e599e4dc97eff9
parentd6e9e8c7b94380c1d1256d94f0d1dae5e1abc40d
sd-event: allocate event source objects with the actually needed size

Currently we allocate fixed-size memory for event sources: the largest
any of the event source type needs. Discrepancy in the sizes needed for
the various event sources is quite major however: it's 144 bytes on
x86_64, i.e. more than two cache lines.

hence, let's be a tiny bit more careful, and allocate exactly as much as
we need, but not more.
src/libsystemd/sd-event/sd-event.c