Re: Review: Hot standby - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Review: Hot standby
Date
Msg-id 20081122141425.GA3813@alvh.no-ip.org
Whole thread Raw
In response to Re: Review: Hot standby  ("Pavan Deolasee" <pavan.deolasee@gmail.com>)
List pgsql-hackers
Pavan Deolasee escribió:
> On Fri, Nov 21, 2008 at 6:59 PM, Simon Riggs <simon@2ndquadrant.com> 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 ?

It's an optimization.  We don't ever free it -- we alloc it once (the
first time the snapshot is taken) and then the allocated space is reused
until the backend dies.  The reason for not using palloc is that if
you're not going to do any context-related management, what would be the
point?  We save the palloc overhead this way (admittedly not a lot).

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Updates of SE-PostgreSQL 8.4devel patches (r1197)
Next
From: Alvaro Herrera
Date:
Subject: Re: HEAD build failure on win32 mingw