From: | Joe Conway <mail(at)joeconway(dot)com> |
---|---|
To: | apb18(at)cornell(dot)edu |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Detoasting and memory usage |
Date: | 2003-07-20 05:13:12 |
Message-ID: | 3F1A24E8.8050302@joeconway.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
apb18(at)cornell(dot)edu wrote:
> I guess my situation is an odd fringe case that probably doesn't happen
> too much, but I thought that knowledge of it might be useful to someone
> somewhere.
See PG_FREE_IF_COPY in fmgr.h
/*
* Support for cleaning up detoasted copies of inputs. This must only
* be used for pass-by-ref datatypes, and normally would only be used
* for toastable types. If the given pointer is different from the
* original argument, assume it's a palloc'd detoasted copy, and pfree
* it.
*
* NOTE: most functions on toastable types do not have to worry about
* this, but we currently require that support functions for indexes
* not leak memory.
*/
#define PG_FREE_IF_COPY(ptr,n) \
do { \
if ((Pointer) (ptr) != PG_GETARG_POINTER(n)) \
pfree(ptr); \
} while (0)
Maybe you can use that or do something similar?
HTH,
Joe
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2003-07-20 05:16:10 | Re: Horrible pg_restore performance, please help |
Previous Message | Ken Godee | 2003-07-20 05:13:08 | Re: Help with privilege or pg_hba.conf |