fixing dllist? - Mailing list pgsql-hackers

From Alvaro Herrera
Subject fixing dllist?
Date
Msg-id 20070321231506.GS4857@alvh.no-ip.org
Whole thread Raw
Responses Re: fixing dllist?  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: fixing dllist?  (Alvaro Herrera <alvherre@commandprompt.com>)
List 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


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Patch for pg_dump
Next
From: Andrew Dunstan
Date:
Subject: Re: Patch for pg_dump