talloc vs malloc speed
Andreas Schneider
asn at samba.org
Mon Apr 17 18:18:04 UTC 2023
On Monday, 17 April 2023 13:07:59 CEST Florian Weimer via samba-technical
wrote:
> * Andreas Schneider:
> > Yes, we have support for destructor callbacks. Can you point me to the
> > attributes which might help talloc?
>
> I think of those listed here
>
> <https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html>
>
> alloc_align, alloc_size, malloc, nothrow, returns_nonnull are relevant,
> but not all them might be appropriate due to the way talloc works.
I've started to look into them, thanks!
The returns_nonnull did recognizable improvements to talloc pool().
Using alloc_size leads to a lot of reports. As soon we access the talloc
header it detects out of bounds access :-)
The malloc attribute can be set to a few functions, that helps. I use the
attribute with the deallocator to avoid issue on free with destructors.
The documentation for nothrow is a bit short. What is an exception in C?
--
Andreas Schneider asn at samba.org
Samba Team www.samba.org
GPG-ID: 8DFF53E18F2ABC8D8F3C92237EE0FC4DCC014E3D
More information about the samba-technical
mailing list