fixing dllist?

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема fixing dllist?
Дата
Msg-id 20070321231506.GS4857@alvh.no-ip.org
обсуждение исходный текст
Ответы Re: fixing dllist?  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: fixing dllist?  (Alvaro Herrera <alvherre@commandprompt.com>)
Список 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 по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Patch for pg_dump
Следующее
От: Andrew Dunstan
Дата:
Сообщение: Re: Patch for pg_dump