Re: Add malloc attribute to memory allocation functions

From: solai v <solai(dot)cdac(at)gmail(dot)com>
To: Tristan Partin <tristan(at)partin(dot)io>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Add malloc attribute to memory allocation functions
Date: 2026-07-06 03:54:25
Message-ID: CAF0whucTdOZNshgQWVTZ3GfO0w6=yzPCZNJCkeTnXY7j_n9o+w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Tristan,
I tested this patch on the current master branch.
Before applying the patch, I checked that functions like palloc(),
MemoryContextAlloc(), and pstrdup() were not annotated with a malloc
attribute.
After applying the patch, I verified that pg_attribute_malloc is added
in src/include/c.h and that the relevant backend and frontend memory
allocation functions are annotated appropriately. I also confirmed
that functions intended to be freed with pfree() use
pg_attribute_malloc(pfree), while the frontend allocation functions
use pg_attribute_malloc(pg_free).
The patch applied cleanly, PostgreSQL built successfully, and make
check completed successfully with all 245 tests passing. I didn't
notice any regressions during testing.

Thanks for working on this patch.

Regards,
Solai

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2026-07-06 04:26:54 Re: Add malloc attribute to memory allocation functions
Previous Message Amit Kapila 2026-07-06 03:48:42 Re: DOCS - Clarify that REFRESH SEQUENCES might be using stale publication data