Thread: pgsql: Use malloc() in GetLockConflicts() when called InHotStandby to
pgsql: Use malloc() in GetLockConflicts() when called InHotStandby to
From
sriggs@postgresql.org (Simon Riggs)
Date:
Log Message: ----------- Use malloc() in GetLockConflicts() when called InHotStandby to avoid repeated palloc calls. Current code assumed this was already true, so this is a bug fix. Modified Files: -------------- pgsql/src/backend/storage/lmgr: lock.c (r1.191 -> r1.192) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/storage/lmgr/lock.c?r1=1.191&r2=1.192)
sriggs@postgresql.org (Simon Riggs) writes: > Log Message: > ----------- > Use malloc() in GetLockConflicts() when called InHotStandby to avoid repeated > palloc calls. Current code assumed this was already true, so this is a bug fix. It seems pretty ugly to allocate the same pointer sometimes with malloc and sometimes with palloc. How about palloc'ing it in TopMemoryContext when you want it to be persistent? regards, tom lane
On Thu, 2010-01-28 at 10:43 -0500, Tom Lane wrote: > sriggs@postgresql.org (Simon Riggs) writes: > > Log Message: > > ----------- > > Use malloc() in GetLockConflicts() when called InHotStandby to avoid repeated > > palloc calls. Current code assumed this was already true, so this is a bug fix. > > It seems pretty ugly to allocate the same pointer sometimes with malloc > and sometimes with palloc. How about palloc'ing it in TopMemoryContext > when you want it to be persistent? Yes, that sounds more graceful. Will do. -- Simon Riggs www.2ndQuadrant.com