Safe memory allocation functions
От
Michael Paquier
Тема
Safe memory allocation functions
Дата
Msg-id
CAB7nPqTvECYmsu6hWRtASivNtBnTBzzSXFmvbaZ2-4+jHa=sNw@mail.gmail.com
Список
Дерево обсуждения
Safe memory allocation functions Michael Paquier <michael.paquier@gmail.com>
Re: Safe memory allocation functions David G Johnston <david.g.johnston@gmail.com>
Re: Safe memory allocation functions Tom Lane <tgl@sss.pgh.pa.us>
Re: Safe memory allocation functions Tom Lane <tgl@sss.pgh.pa.us>
Re: Safe memory allocation functions Robert Haas <robertmhaas@gmail.com>
Re: Safe memory allocation functions Alvaro Herrera <alvherre@2ndquadrant.com>
Re: Safe memory allocation functions Robert Haas <robertmhaas@gmail.com>
Re: Safe memory allocation functions Andres Freund <andres@2ndquadrant.com>
Re: Safe memory allocation functions Robert Haas <robertmhaas@gmail.com>
Re: Safe memory allocation functions Alvaro Herrera <alvherre@2ndquadrant.com>
Re: Safe memory allocation functions Robert Haas <robertmhaas@gmail.com>
Re: Safe memory allocation functions Alvaro Herrera <alvherre@2ndquadrant.com>
Re: Safe memory allocation functions Andres Freund <andres@2ndquadrant.com>
Re: Safe memory allocation functions Alvaro Herrera <alvherre@2ndquadrant.com>
Re: Safe memory allocation functions Andres Freund <andres@2ndquadrant.com>
Re: Safe memory allocation functions Alvaro Herrera <alvherre@2ndquadrant.com>
Re: Safe memory allocation functions Michael Paquier <michael.paquier@gmail.com>
Re: Safe memory allocation functions Andres Freund <andres@2ndquadrant.com>
Re: Safe memory allocation functions Michael Paquier <michael.paquier@gmail.com>
Re: Safe memory allocation functions Robert Haas <robertmhaas@gmail.com>
Re: Safe memory allocation functions Michael Paquier <michael.paquier@gmail.com>
Re: Safe memory allocation functions Michael Paquier <michael.paquier@gmail.com>
Re: Safe memory allocation functions Robert Haas <robertmhaas@gmail.com>
Re: Safe memory allocation functions Michael Paquier <michael.paquier@gmail.com>
Re: Safe memory allocation functions Robert Haas <robertmhaas@gmail.com>
Re: Safe memory allocation functions Michael Paquier <michael.paquier@gmail.com>
Re: Safe memory allocation functions Michael Paquier <michael.paquier@gmail.com>
Re: Safe memory allocation functions Andres Freund <andres@2ndquadrant.com>
Re: Safe memory allocation functions Michael Paquier <michael.paquier@gmail.com>
Re: Safe memory allocation functions Andres Freund <andres@2ndquadrant.com>
Re: Safe memory allocation functions Michael Paquier <michael.paquier@gmail.com>
Hi all, For the last couple of weeks it has been mentioned a couple of times that it would be useful to have a set of palloc APIs able to return NULL on OOM to allow certain code paths to not ERROR and to take another route when memory is under pressure. This has been for example mentioned on the FPW compression thread or here: http://www.postgresql.org/message-id/CAB7nPqRbewhSbJ_tkAogtpcMrxYJsvKKB9p030d0TpijB4t3YA@mail.gmail.com Attached is a patch adding the following set of functions for frontend and backends returning NULL instead of reporting ERROR when allocation fails: - palloc_safe - palloc0_safe - repalloc_safe This has simply needed some refactoring in aset.c to set up the new functions by passing an additional control flag, and I didn't think that adding a new safe version for AllocSetContextCreate was worth it. Those APIs are not called anywhere yet, but I could for example write a small extension for that that could be put in src/test/modules or publish on github in my plugin repo. Also, I am not sure if this is material for 9.5, even if the patch is not complicated, but let me know if you are interested in it and I'll add it to the next CF. Regards, -- Michael
В списке pgsql-hackers по дате отправления