summaryrefslogtreecommitdiff
path: root/src/backend/storage/ipc
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/storage/ipc')
-rw-r--r--src/backend/storage/ipc/procarray.c8
-rw-r--r--src/backend/storage/ipc/shm_mq.c2
-rw-r--r--src/backend/storage/ipc/shmem.c6
3 files changed, 7 insertions, 9 deletions
diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c
index 200f72c6e25..f3a1603204e 100644
--- a/src/backend/storage/ipc/procarray.c
+++ b/src/backend/storage/ipc/procarray.c
@@ -1162,7 +1162,7 @@ ProcArrayApplyRecoveryInfo(RunningTransactions running)
* Allocate a temporary array to avoid modifying the array passed as
* argument.
*/
- xids = palloc(sizeof(TransactionId) * (running->xcnt + running->subxcnt));
+ xids = palloc_array(TransactionId, running->xcnt + running->subxcnt);
/*
* Add to the temp array any xids which have not already completed.
@@ -3012,8 +3012,7 @@ GetVirtualXIDsDelayingChkpt(int *nvxids, int type)
Assert(type != 0);
/* allocate what's certainly enough result space */
- vxids = (VirtualTransactionId *)
- palloc(sizeof(VirtualTransactionId) * arrayP->maxProcs);
+ vxids = palloc_array(VirtualTransactionId, arrayP->maxProcs);
LWLockAcquire(ProcArrayLock, LW_SHARED);
@@ -3293,8 +3292,7 @@ GetCurrentVirtualXIDs(TransactionId limitXmin, bool excludeXmin0,
int index;
/* allocate what's certainly enough result space */
- vxids = (VirtualTransactionId *)
- palloc(sizeof(VirtualTransactionId) * arrayP->maxProcs);
+ vxids = palloc_array(VirtualTransactionId, arrayP->maxProcs);
LWLockAcquire(ProcArrayLock, LW_SHARED);
diff --git a/src/backend/storage/ipc/shm_mq.c b/src/backend/storage/ipc/shm_mq.c
index 2c79a649f46..9c888d3eb78 100644
--- a/src/backend/storage/ipc/shm_mq.c
+++ b/src/backend/storage/ipc/shm_mq.c
@@ -289,7 +289,7 @@ shm_mq_get_sender(shm_mq *mq)
shm_mq_handle *
shm_mq_attach(shm_mq *mq, dsm_segment *seg, BackgroundWorkerHandle *handle)
{
- shm_mq_handle *mqh = palloc(sizeof(shm_mq_handle));
+ shm_mq_handle *mqh = palloc_object(shm_mq_handle);
Assert(mq->mq_receiver == MyProc || mq->mq_sender == MyProc);
mqh->mqh_queue = mq;
diff --git a/src/backend/storage/ipc/shmem.c b/src/backend/storage/ipc/shmem.c
index ee3408df301..7b63c7dc90a 100644
--- a/src/backend/storage/ipc/shmem.c
+++ b/src/backend/storage/ipc/shmem.c
@@ -599,7 +599,7 @@ pg_get_shmem_allocations_numa(PG_FUNCTION_ARGS)
InitMaterializedSRF(fcinfo, 0);
max_nodes = pg_numa_get_max_node();
- nodes = palloc(sizeof(Size) * (max_nodes + 1));
+ nodes = palloc_array(Size, max_nodes + 1);
/*
* Shared memory allocations can vary in size and may not align with OS
@@ -624,8 +624,8 @@ pg_get_shmem_allocations_numa(PG_FUNCTION_ARGS)
* them using only fraction of the total pages.
*/
shm_total_page_count = (ShmemSegHdr->totalsize / os_page_size) + 1;
- page_ptrs = palloc0(sizeof(void *) * shm_total_page_count);
- pages_status = palloc(sizeof(int) * shm_total_page_count);
+ page_ptrs = palloc0_array(void *, shm_total_page_count);
+ pages_status = palloc_array(int, shm_total_page_count);
if (firstNumaTouch)
elog(DEBUG1, "NUMA: page-faulting shared memory segments for proper NUMA readouts");