[patch] add a 'dont_pack_binaries' option to open_port/2 to disable packing small binaries in port_command/2

Romain Lenglet <>
Fri May 12 07:59:40 CEST 2006


Hello,

Here is a patch that adds an option to open_port/2 that disables 
binaries packing in the implementation of port_command/2. 
Packing is normally triggered when more than 16 binaries are 
passed in the io-list. In that case, contiguous "small enough" 
binaries are copied together into single buffers.
With this patch, when this option is set, packing is never 
triggered, ensuring that all binaries are passed by reference 
and are never copied.

Preventing packing is necessary when the boundaries between 
binaries must be preserved.

This patch is against the otp_src_R10B_2006-02-27 snapshot.

I have no patch for the documentation, but I suggest adding this 
comment into the documentation about open_port/2, in 
the 'erlang' module documentation:

dont_pack_binaries
  Prevents packing (copying/grouping of small binaries in 
io-lists into larger buffers) in calls to port_command/2.


Regards,

-- 
Romain LENGLET
-------------- next part --------------
A non-text attachment was scrubbed...
Name: otp-dontpackbins_2006-05-12.patch
Type: text/x-diff
Size: 3473 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20060512/6a6f07fd/attachment.bin>


More information about the erlang-bugs mailing list