Add malloc attribute to memory allocation functions
Tristan Partin <tristan@partin.io>
From: "Tristan Partin" <tristan@partin.io>
To: "pgsql-hackers" <pgsql-hackers@postgresql.org>
Date: 2026-07-01T17:51:25Z
Lists: pgsql-hackers
Attachments
- v1-0001-Add-malloc-attribute-to-memory-allocation-functio.patch (text/x-patch) patch v1-0001
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)