[erlang-questions] erl_driver: is char *buf from control safe?

Lukas Larsson lukas@REDACTED
Tue Sep 9 22:33:59 CEST 2014


On Tue, Sep 9, 2014 at 9:41 PM, Max Lapshin <max.lapshin@REDACTED> wrote:

> Can  driver_deq API guarantee that output binary will not be copied?
>

If the binary is an offheap binary (which I guess your binaries are), then
it will most likely never be copied. The function outputv, driver_enqv,
driver_peekqv and driver_deq are built specifically to do as little copying
as is possible. I can see in the code that there are cases when binaries
are copied, but I don't know when and why they might be triggered, I don't
think they will be for your usecase.

If you have problems figuring out how to use the API, file write in the
efile driver is the primary example to look at. Or maybe the test code?
https://github.com/erlang/otp/blob/maint/erts/emulator/test/driver_SUITE_data/queue_drv.c
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140909/49635abe/attachment.htm>


More information about the erlang-questions mailing list