On 2 September 2016 at 01:12, Anderson Carniel <accarn...@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 -- Sent via pgsql-hackers mailing list (email@example.com) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers