Re: Safe memory allocation functions
От | Michael Paquier |
---|---|
Тема | Re: Safe memory allocation functions |
Дата | |
Msg-id | CAB7nPqQS4A4B9HsxXfRJoiy2v5-iN8k+=Bam0FcOX_5MCX3xhw@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Safe memory allocation functions (Alvaro Herrera <alvherre@2ndquadrant.com>) |
Ответы |
Re: Safe memory allocation functions
|
Список | pgsql-hackers |
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 definitely do not want to push the nofail stuff via the >> MemoryContextData-> API into aset.c. Imo aset.c should always return >> NULL and then mcxt.c should throw the error if in the normal palloc() >> function. > > Sure, that seems reasonable ... Yes, this would simplify the footprint of this patch to aset.c to a minimum by changing the ereport to NULL in a couple of places. -- Michael
В списке pgsql-hackers по дате отправления: