Add malloc attribute to memory allocation functions - Mailing list pgsql-hackers

From Tristan Partin
Subject Add malloc attribute to memory allocation functions
Date
Msg-id DJNFBUWD276K.2OPIYJQS75W84@partin.io
Whole thread
Responses Re: Add malloc attribute to memory allocation functions
Re: Add malloc attribute to memory allocation functions
List pgsql-hackers
Given that we now have a tree that compiles fine against
-Werror=mismatched-dealloc, we need to make sure that we don't regress.
By adding the malloc attribute[0], we can protect against regressions,
enable more accurate code coverage with -fanalyzer, and allow the
compiler to do some optimizations.

Let me know if I missed any allocators. Additionally, does it make sense
to add the attribute to the various memory context allocator functions
like AllocSetAlloc(), or only on the higher level functions.

[0]: https://gcc.gnu.org/onlinedocs/gcc/Common-Attributes.html#index-malloc

--
Tristan Partin
PostgreSQL Contributors Team
AWS (https://aws.amazon.com)

Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Macro redefinition warning after aeb07c55fab5c17a600b77ffcdc3b71425d6a8e7
Next
From: Andrey Borodin
Date:
Subject: Re: [PATCH v1] Allow excluded tables to remain in the pg_restore data-loading path for directory-format dumps