[PATCH] unified frontend support for pg_malloc et al and palloc/pfree mulation (was xlogreader-v4)

Поиск
Список
Период
Сортировка
От Andres Freund
Тема [PATCH] unified frontend support for pg_malloc et al and palloc/pfree mulation (was xlogreader-v4)
Дата
Msg-id 1357730830-25999-1-git-send-email-andres@2ndquadrant.com
обсуждение исходный текст
Ответ на Re: [PATCH 2/5] Make relpathbackend return a statically result instead of palloc()'ing it  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы [PATCH 1/2] Provide a common malloc wrappers and palloc et al. emulation for frontend'ish environs  (Andres Freund <andres@2ndquadrant.com>)
Re: [PATCH] unified frontend support for pg_malloc et al and palloc/pfree mulation (was xlogreader-v4)  (Heikki Linnakangas <hlinnakangas@vmware.com>)
Список pgsql-hackers
Hi,

As promised here's a patch to provide palloc emulation for frontend-ish
environments.

The patch:
- makes palloc() into a real function so CurrentMemoryContext doesn't need to be provided
- provides common pg_(malloc,malloc0, realloc, strdup, free) wrappers and removes various versions of those across
differentutilities
 
- removes ugly palloc redefinery for frontend use of backend code (dirmod.c)

Controversial/Unclear things:
- palloc[0] are currently copies of the MemoryContextAlloc[Zero] functions to preclude performance regressions, imo the
levelof duplication is ok though
 
- the common memory management is implemented in [pg]port/palloc.[ch], I am not too happy with the name and location
- pgport/palloc.c is only built in the backend, not sure if there is a nicer way to do this from a make POV
- the different versions of pg_malloc et al used different error signaling methods, I've settled on    fprintf(stderr,
_("outof memory\n"));    exit(EXIT_FAILURE);
 

Results in a nice net removal of code:37 files changed, 218 insertions(+), 621 deletions(-)




В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: [PATCH 2/2] use pg_malloc instead of an unchecked malloc in pg_resetxlog
Следующее
От: Andres Freund
Дата:
Сообщение: [PATCH 1/2] Provide a common malloc wrappers and palloc et al. emulation for frontend'ish environs