Re: Idea: closing the loop for "pg_ctl reload"

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Idea: closing the loop for "pg_ctl reload"
Дата
Msg-id 6225.1425318280@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Idea: closing the loop for "pg_ctl reload"  (Jan de Visser <jan@de-visser.net>)
Ответы Re: Idea: closing the loop for "pg_ctl reload"  (Jan de Visser <jan@de-visser.net>)
Список pgsql-hackers
Jan de Visser <jan@de-visser.net> writes:
> On March 2, 2015 09:50:49 AM Tom Lane wrote:
>> However, you could and should use pg_malloc0, which takes care of that
>> for you...

> I am (using pg_malloc, that is). So, just to be sure: pg_malloc memsets the 
> block to 0, right? 

No, it doesn't, but pg_malloc0 does.  Consult the code if you're confused:
src/common/fe_memutils.c

> My question was more along the lines if memsetting to 0 to ensure that pointer 
> fields are NULL and int/long fields are 0.

Yes, we do assume that widely, and so does a heck of a lot of other code.
In principle the C standard doesn't require that a NULL pointer be
all-zero-bits, only that casting "0" to a pointer yield a NULL pointer.
But certainly there are no modern implementations that don't represent
NULL as 0.  Anybody who tried to do it differently would soon find that
hardly any real-world C code would run on their platform.
        regards, tom lane



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

Предыдущее
От: Heikki Linnakangas
Дата:
Сообщение: Re: INSERT ... ON CONFLICT {UPDATE | IGNORE} 2.0
Следующее
От: Andres Freund
Дата:
Сообщение: Re: Merge compact/non compact commits, make aborts dynamically sized