Re: Missing checks when malloc returns NULL...

Поиск
Список
Период
Сортировка
Искать
От
Aleksander Alekseev
Тема
Re: Missing checks when malloc returns NULL...
Дата
Msg-id
20160830133048.GA84635@e733
Ответ на
Список
Дерево обсуждения
Missing checks when malloc returns NULL... Michael Paquier <michael.paquier@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... Michael Paquier <michael.paquier@gmail.com>
Re: Missing checks when malloc returns NULL... Heikki Linnakangas <hlinnaka@iki.fi>
Re: Missing checks when malloc returns NULL... Michael Paquier <michael.paquier@gmail.com>
Re: Missing checks when malloc returns NULL... Michael Paquier <michael.paquier@gmail.com>
Re: Missing checks when malloc returns NULL... Aleksander Alekseev <a.alekseev@postgrespro.ru>
Re: Missing checks when malloc returns NULL... Aleksander Alekseev <a.alekseev@postgrespro.ru>
Re: Missing checks when malloc returns NULL... Michael Paquier <michael.paquier@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... Aleksander Alekseev <a.alekseev@postgrespro.ru>
Re: Missing checks when malloc returns NULL... Tom Lane <tgl@sss.pgh.pa.us>
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... 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... 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... 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... 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... Aleksander Alekseev <a.alekseev@postgrespro.ru>
Re: Missing checks when malloc returns NULL... Michael Paquier <michael.paquier@gmail.com>
Re: Missing checks when malloc returns NULL... Aleksander Alekseev <a.alekseev@postgrespro.ru>
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... Tom Lane <tgl@sss.pgh.pa.us>
Re: Missing checks when malloc returns NULL... Michael Paquier <michael.paquier@gmail.com>
> > I think what we ought to do is make ShmemAlloc act like palloc
> > (ie throw error not return NULL), and remove the duplicated error
> > checks.  For the one caller that that would be bad for, we could
> > invent something like ShmemAllocNoError, or ShmemAllocExtended with
> > a no_error flag, or whatever other new API suits your fancy.  But
> > as-is, it's just inviting more errors-of-omission like the large
> > number that already exist.  I think people are conditioned by palloc
> > to expect such functions to throw error.
> 
> The only reason why I did not propose that for ShmemAlloc is because
> of extensions potentially using this routine and having some special
> handling when it returns NULL. And changing it to behave like palloc
> would break such extensions.

I suggest to keep ShmemAlloc as is for backward compatibility and
introduce a new procedure ShmemAllocSafe. Also we could add a scary
comment (and also a warning log message?) that ShmemAlloc is deprecated
and possibly will be removed in later releases.

-- 
Best regards,
Aleksander Alekseev


В списке pgsql-hackers по дате отправления
От: Michael Paquier
Дата:
От: Michael Paquier
Дата:
FAQ