Add assertion for failed alloc to palloc0() and palloc_extended()
Andreas Karlsson <andreas@proxel.se>
From: Andreas Karlsson <andreas@proxel.se>
To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-03-01T00:05:43Z
Lists: pgsql-hackers
Attachments
Hi, I noticed that we have Assert(ret != NULL) in palloc() but not in palloc0() so for consistency I decided to add it. I also added an assertion that the MCXT_ALLOC_NO_OOM flag is set if alloc() returns NULL to palloc_extended(). I feel that this might be useful since while palloc() is much more common the OOM which causes alloc() to incorrectly return NULL could in theory happen in any of the three functions. Andreas