From: | Alvaro Herrera <alvherre(at)commandprompt(dot)com> |
---|---|
To: | Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | fixing dllist? |
Date: | 2007-03-21 23:15:06 |
Message-ID: | 20070321231506.GS4857@alvh.no-ip.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
While coding the autovacuum stuff I noticed that the dllist.c doubly
linked list infrastructure is using malloc(). And the failure cases are
handled in #ifdef FRONTEND exit(1) #else elog(ERROR) #endif.
This seems a bit ugly, but more importantly, it doesn't let me free the
whole list by simply resetting a context. Would anybody be too upset if
I wholesaledly changed malloc() to palloc() and get rid of the #ifdef
FRONTEND? AFAICS, no frontend code in our tree uses it. (Currently,
the code to free the list walks it node by node).
A less invasive alternative would be
#ifdef FRONTEND
#define DLLALLOC(x) malloc(x)
#else
#define DLLALLOC(c) palloc(x)
#endif
One problem with using palloc() at all is that it would use a little bit
more memory, but we don't seem to be very worried about that.
Currently, dllist is mostly used to keep track of the backend list in
postmaster, and the tuple lists in the catalog cache.
Opinions?
--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Dunstan | 2007-03-21 23:21:23 | Re: Patch for pg_dump |
Previous Message | Tom Lane | 2007-03-21 22:46:04 | Re: Patch for pg_dump |