Skip site navigation (1) Skip section navigation (2)

Re: Bug #548: Misleading documentation of `palloc'

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: hkrug(at)rationalizer(dot)com, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Bug #548: Misleading documentation of `palloc'
Date: 2002-01-02 16:28:08
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-bugs
pgsql-bugs(at)postgresql(dot)org writes:
> I propose to make the documentation more concise in this point and to
> add a macro like:

> #define palloc_tx(sz)  MemoryContextAlloc(TopTransactionContext, (sz))

I don't think it's a good idea to encourage people to allocate in
TopTransactionContext as a substitute for thought.  One of the main
reasons for developing the memory context mechanism was to get rid
of transaction-duration memory leaks.  People who want to allocate
storage that will outlive a single function call need to think about
exactly how long it needs to live and when/where/how it will be

I agree that the particular paragraph you identified is oversimplified,
but the right thing is to fix the documentation not add another layer
of oversimplification.

			regards, tom lane

In response to

pgsql-bugs by date

Next:From: Dmitry FomichevDate: 2002-01-03 01:29:03
Subject: Refcursor problem
Previous:From: pgsql-bugsDate: 2002-01-02 08:24:42
Subject: Bug #548: Misleading documentation of `palloc'

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group