pgsql: Use malloc() in GetLockConflicts() when called InHotStandby to
pgsql: Use malloc() in GetLockConflicts() when called InHotStandby to
От:
sriggs@postgresql.org (Simon Riggs)
Дата:
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)
Re: pgsql: Use malloc() in GetLockConflicts() when called InHotStandby to
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
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
Re: pgsql: Use malloc() in GetLockConflicts() when called InHotStandby to
От:
Simon Riggs <simon@2ndQuadrant.com>
Дата:
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