2

open() sets a memory buffer as defined by io.h: IOS_BUFSIZE = 32kb (previously 128kb)

Is it possible to change that value (future open kwargs?) or adapt it to disk blocksize (often very large in GPFS, etc)?

1
  • Have you considered using mmap? Commented Dec 8, 2020 at 14:50

1 Answer 1

2

As far as I can tell, it's currently not possible to change this from Julia (short of re-implementing ios.c:_buf_realloc in Julia). It would be pretty easy to add this feature to Julia via a PR. e.g. add something like the following to src/support/ios.c:

int ios_growbuf(ios_t *s, size_t sz)
{
    return _buf_realloc(s, sz) == NULL;
}

and then something like the following in base/iostream.jl:

function sizehint!(s::IOStream, sz::Integer)
    ccall(:ios_growbuf, Cint, (Ptr{Cvoid}, Csize_t), s.ios, sz) != 0 &&
        throw(OutOfMemoryError())
end
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.