Re: Review: Hot standby
От | Simon Riggs |
---|---|
Тема | Re: Review: Hot standby |
Дата | |
Msg-id | 1227352120.7015.133.camel@hp_dx2400_1 обсуждение исходный текст |
Ответ на | Re: Review: Hot standby ("Pavan Deolasee" <pavan.deolasee@gmail.com>) |
Список | pgsql-hackers |
On Sat, 2008-11-22 at 15:14 +0530, Pavan Deolasee wrote: > > The malloc was part of the existing code, explained by > comments. > > > Oh I see. But I don't see any explanations for using malloc instead of > palloc. Not that the current patch is responsible for this, I am > wondering why its done that way and if we are freeing the malloced > memory at all ? > > malloc is used at another place in a new code. Although it seems that > the allocation happens just once, please check if its better to use > palloc there. Thanks for your comments. OK, here's my thoughts after checking. The malloc in the current code occurs within GetSnapshotData where it exists to optimise memory allocation. The memory is allocated once and never released, so malloc is appropriate. The patch adds another use of malloc in GetRunningTransactionData() which is similar to GetSnapshotData in many ways. It only ever runs within bgwriter, and again, once allocated the memory is never released. So malloc is appropriate there also. I will change the #define as you suggested earlier. -- Simon Riggs www.2ndQuadrant.comPostgreSQL Training, Services and Support
В списке pgsql-hackers по дате отправления: