Re: xmalloc => pg_malloc

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: xmalloc => pg_malloc
Дата
Msg-id 8988.1349195433@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: xmalloc => pg_malloc  (Andres Freund <andres@2ndquadrant.com>)
Ответы Re: xmalloc => pg_malloc
Re: xmalloc => pg_malloc
Список pgsql-hackers
Andres Freund <andres@2ndquadrant.com> writes:
>> pg_calloc    (randomly different API for pg_malloc0)

> Do we need this?

I thought about getting rid of it, but there are some dozens of calls
scattered across several files, so I wasn't sure it was worth it.
Anybody else have an opinion?

> I wonder whether the same set of functions should also be available in the 
> backend with ereport(EC_OUT_OF_MEMORY, ...) behaviour as well.

In the backend, you almost always ought to be using palloc instead.
The only places where it's really appropriate to be using malloc
directly are where you don't want an error thrown for out-of-memory.
So I think providing these in the backend would do little except to
encourage bad programming.
        regards, tom lane



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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: xmalloc => pg_malloc
Следующее
От: Phil Sorber
Дата:
Сообщение: Re: xmalloc => pg_malloc