From: | Simon Riggs <simon(at)2ndQuadrant(dot)com> |
---|---|
To: | Pavan Deolasee <pavan(dot)deolasee(at)gmail(dot)com> |
Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Review: Hot standby |
Date: | 2008-11-22 11:08:40 |
Message-ID: | 1227352120.7015.133.camel@hp_dx2400_1 |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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.com
PostgreSQL Training, Services and Support
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2008-11-22 12:59:35 | Re: Updates of SE-PostgreSQL 8.4devel patches (r1197) |
Previous Message | Peter Eisentraut | 2008-11-22 11:05:19 | Re: HEAD build failure on win32 mingw |