pgsql: Add more assertions in palloc0() and palloc_extended()

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Add more assertions in palloc0() and palloc_extended()
Date: 2025-03-04 01:54:01
Message-ID: E1tpHTt-000ffR-0R@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Add more assertions in palloc0() and palloc_extended()

palloc() includes an assertion checking that an alloc() implementation
never returns NULL for all MemoryContextMethods.

This commit adds a similar assertion in palloc0(). In palloc_extend(),
a different assertion is added, checking that MCXT_ALLOC_NO_OOM is set
when an alloc() routine returns NULL. These additions can be useful to
catch errors when implementing a new set of MemoryContextMethods
routines.

Author: Andreas Karlsson <andreas(at)proxel(dot)se>
Discussion: https://postgr.es/m/507e8eba-2035-4a12-a777-98199a66beb8@proxel.se

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/40d3f8274499cb1dd349f60f2e5915f907acce6e

Modified Files
--------------
src/backend/utils/mmgr/mcxt.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2025-03-04 05:12:39 pgsql: Split pgstat_bestart() into three different routines
Previous Message Masahiko Sawada 2025-03-03 23:44:20 pgsql: doc: Convert UUID functions list to table format.