diff options
author | Sverker Eriksson <[email protected]> | 2014-09-03 17:13:22 +0200 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2014-09-03 17:13:22 +0200 |
commit | b182aa2cfab793e566c92183c361e78f4d6f84cb (patch) | |
tree | 4821839fdc9c5ea0d8bdd81bd5b02785f0937ccc /system | |
parent | c472c3f5aafc81a409d0443c4601de43bafb53cb (diff) | |
download | otp-b182aa2cfab793e566c92183c361e78f4d6f84cb.tar.gz otp-b182aa2cfab793e566c92183c361e78f4d6f84cb.tar.bz2 otp-b182aa2cfab793e566c92183c361e78f4d6f84cb.zip |
erts: Fix bug with enif_make_copy reallocating writable binary
that could invalidate a pointer received from an earlier
call to enif_inspect_binary.
Solution: Emasculate writable binary at enif_inspect_binary. There are
room for optimizations here as we now do an unconditional emasculation
even though enif_make_copy is not called later in the NIF.
Diffstat (limited to 'system')
-rw-r--r-- | system/doc/efficiency_guide/binaryhandling.xml | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/system/doc/efficiency_guide/binaryhandling.xml b/system/doc/efficiency_guide/binaryhandling.xml index 6b0df49011..4ba1378059 100644 --- a/system/doc/efficiency_guide/binaryhandling.xml +++ b/system/doc/efficiency_guide/binaryhandling.xml @@ -5,7 +5,7 @@ <header> <copyright> <year>2007</year> - <year>2013</year> + <year>2014</year> <holder>Ericsson AB, All Rights Reserved</holder> </copyright> <legalnotice> @@ -237,8 +237,9 @@ Bin = <<Bin1,...>> %% Bin1 will be COPIED <p><c>Bin1</c> will be copied in the third line.</p> <p>The same thing happens if you insert a binary into an <em>ets</em> - table or send it to a port using <c>erlang:port_command/2</c>.</p> - + table or send it to a port using <c>erlang:port_command/2</c> or pass it to + <seealso marker="erts:erl_nif#enif_inspect_binary">enif_inspect_binary</seealso> + in a NIF.</p> <p>Matching a binary will also cause it to shrink and the next append operation will copy the binary data:</p> |