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