Re: Safe memory allocation functions
От | Andres Freund |
---|---|
Тема | Re: Safe memory allocation functions |
Дата | |
Msg-id | 20150127083413.GJ4655@awork2.anarazel.de обсуждение исходный текст |
Ответ на | Re: Safe memory allocation functions (Michael Paquier <michael.paquier@gmail.com>) |
Ответы |
Re: Safe memory allocation functions
|
Список | pgsql-hackers |
On 2015-01-27 17:27:53 +0900, Michael Paquier wrote: > Alvaro Herrera wrote: > >> So how about something like > >> > >> #define ALLOCFLAG_HUGE 0x01 > >> #define ALLOCFLAG_NO_ERROR_ON_OOM 0x02 > >> void * > >> MemoryContextAllocFlags(MemoryContext context, Size size, int flags); > The flag for huge allocations may be useful, but I don't actually see > much value in the flag ALLOC_NO_OOM if the stuff in aset.c returns > unconditionally NULL in case of an OOM and we let palloc complain > about an OOM when allocation returns NULL. Something I am missing > perhaps? I guess the idea is to have *user facing* MemoryContextAllocExtended() that can do both huge and no-oom allocations. Otherwise we need palloc like wrappers for all combinations. We're certainly not just going to ignore memory allocation failures generally in in MemoryContextAllocExtended().... Greetings, Andres Freund -- Andres Freund http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training & Services
В списке pgsql-hackers по дате отправления: