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

#define DLLALLOC(x) malloc(x)
#define DLLALLOC(c) palloc(x)

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.


Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Reply via email to