Re: What is the posix_memalign() equivalent for the PostgreSQL?

Поиск
Список
Период
Сортировка
От Craig Ringer
Тема Re: What is the posix_memalign() equivalent for the PostgreSQL?
Дата
Msg-id CAMsr+YENaQkaMGp2nTkYkVL04-Amfyaev-RWuRVV+pzCDxia4w@mail.gmail.com
обсуждение исходный текст
Ответ на What is the posix_memalign() equivalent for the PostgreSQL?  (Anderson Carniel <accarniel@gmail.com>)
Ответы Re: What is the posix_memalign() equivalent for the PostgreSQL?  (Anderson Carniel <accarniel@gmail.com>)
Список pgsql-hackers
On 2 September 2016 at 01:12, Anderson Carniel <accarniel@gmail.com> wrote:
> Dear all,
>
> I am developing an extension for the PostgreSQL that write/read some
> external files from the PostgreSQL. In order to write/read, I am using the
> O_DIRECT flag and using the posix_memalign to allocate memory. I would like
> to know if the postgresql internal library provides an equivalent function
> for the posix_memalign since I am getting unexpected errors.

"unexpected errors". Details please?

If you're trying to allocate aligned memory, I believe PostgreSQL
typically uses the TYPEALIGN macros (see c.h) but I'm painfully
clueless in the area, so ... yeah. Don't trust me.

I was a bit surprised not to see a MemoryContextAlloc or palloc
variant that returns memory aligned to a given boundary.

> All my
> allocations are in the TopMemoryContext since I am working with several
> buffers that must be alive while the PostgreSQL Server is activated.

You can't posix_memalign into TopMemoryContext. Such memory is outside
the memory context system, like memory directly malloc()'d.

-- Craig Ringer                   http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training & Services



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Rahila Syed
Дата:
Сообщение: Re: Surprising behaviour of \set AUTOCOMMIT ON
Следующее
От: Etsuro Fujita
Дата:
Сообщение: Re: Push down more full joins in postgres_fdw