Re: Do we want a xmalloc or similar function in the Backend?
В списке pgsql-hackers по дате отправления:
| От | Tom Lane |
|---|---|
| Тема | Re: Do we want a xmalloc or similar function in the Backend? |
| Дата | |
| Msg-id | 12259.1340116736@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Do we want a xmalloc or similar function in the Backend? (Andres Freund <andres@2ndquadrant.com>) |
| Ответы |
Re: Do we want a xmalloc or similar function in the Backend?
|
| Список | pgsql-hackers |
Andres Freund <andres@2ndquadrant.com> writes:
> There are 70+ calls of malloc in the backend in the form of
> type* foo = malloc(sizeof(...));
> if(!foo)
> elog(ERROR, "could not allocate memory");
> which is a bit annoying to write at times. Would somebody argue against
> introducing a function that does the above named xmalloc() or malloc_or_die()?
99% of the time, you should be using palloc if that's the behavior you
want. I think most of the malloc calls are in places where we want a
bit more control over the error response.
regards, tom lane
В списке pgsql-hackers по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера