Re: [INTERFACES] ECPG: FETCH ALL|n FROM cursor - Memory allocation?

Michael Meskes <meskes@postgresql.org>

From: Michael Meskes <meskes@postgresql.org>
To: PostgreSQL Interfaces <pgsql-interfaces@postgresql.org>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2002-05-06T10:59:58Z
Lists: pgsql-hackers
On Mon, May 06, 2002 at 09:37:18AM +0200, Christof Petig wrote:
> Never, never mix these two! ECPGfree_auto_mem will free even memory 
> which has already been free'd by the user, perhaps we should get rid of 

That's why I discourage the usage of ECPGfree_auto_mem by the user.
There is only one reason why the symbol is not static and that is that
it is used by another module in libecpg.

I never thought about this as an end user routine, it's just meant as a
clean up method in case of an error during statement execution.

BTW Christof, ECPGfree_auto_mem is used by testdynalloc.pgc. Maybe we
should change that.

> this method (any allocated memory regions are stored in a list, if you 
> never call ECPGfree_auto_mem, this list grows and grows).

That is not true. Before a statement is executed libecpg calls
ECPGclear_auto_mem which just frees ecpg's own structure but not the
memory used for data.

Michael
-- 
Michael Meskes
Michael@Fam-Meskes.De
Go SF 49ers! Go Rhein Fire!
Use Debian GNU/Linux! Use PostgreSQL!