Re: Missing checks when malloc returns NULL...

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: Missing checks when malloc returns NULL...
Дата
Msg-id CAB7nPqRRR8mnM9kbGObV2tzP-BpmLotiKyVBPbY2bxjuAyeCpw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Missing checks when malloc returns NULL...  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Missing checks when malloc returns NULL...  (Michael Paquier <michael.paquier@gmail.com>)
Re: Missing checks when malloc returns NULL...  (Heikki Linnakangas <hlinnaka@iki.fi>)
Список pgsql-hackers
On Tue, Jun 21, 2016 at 10:46 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Michael Paquier <michael.paquier@gmail.com> writes:
>> - mcxt.c uses that, which is surprising:
>> @@ -704,7 +704,8 @@ MemoryContextCreate(NodeTag tag, Size size,
>>     {
>>         /* Special case for startup: use good ol' malloc */
>>         node = (MemoryContext) malloc(needed);
>> -       Assert(node != NULL);
>> +       if (node == NULL)
>> +           elog(PANIC, "out of memory");
>>     }
>> I think that a PANIC is cleaner here instead of a simple crash.
>
> But the elog mechanism assumes that memory contexts are working.
> If this ever actually did fire, no good would come of it.

OK, there is not much that we can do here then. What about the rest?
Those seem like legit concerns to me.
--
Michael

Вложения

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

Предыдущее
От: Andres Freund
Дата:
Сообщение: signed division in hash_search_with_hash_value(ENTER) has high overhead
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: primary_conninfo missing from pg_stat_wal_receiver