diff options
author | Sverker Eriksson <sverker@erlang.org> | 2019-05-20 19:32:31 +0200 |
---|---|---|
committer | Sverker Eriksson <sverker@erlang.org> | 2019-05-20 19:32:54 +0200 |
commit | 6a84dd2db8b26dd3332b3a3da8aab9f1887860bd (patch) | |
tree | 62b4368678f0aae7ab14e09aa2fd0103023ad8e8 /lib | |
parent | 6618ce7b6a621e92db72ea4f01f7d38553c8818c (diff) | |
download | otp-6a84dd2db8b26dd3332b3a3da8aab9f1887860bd.tar.gz otp-6a84dd2db8b26dd3332b3a3da8aab9f1887860bd.tar.bz2 otp-6a84dd2db8b26dd3332b3a3da8aab9f1887860bd.zip |
stdlib: Improve example for binary:referenced_byte_size/1
Diffstat (limited to 'lib')
-rw-r--r-- | lib/stdlib/doc/src/binary.xml | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/stdlib/doc/src/binary.xml b/lib/stdlib/doc/src/binary.xml index f3d4edd30f..fd991f258b 100644 --- a/lib/stdlib/doc/src/binary.xml +++ b/lib/stdlib/doc/src/binary.xml @@ -505,15 +505,16 @@ store(Binary, GBSet) -> <<1,1,1,1,1 ... 2> byte_size(A). 100 -3> binary:referenced_byte_size(A) +3> binary:referenced_byte_size(A). 100 -4> <<_:10/binary,B:10/binary,_/binary>> = A. +4> <<B:10/binary, C:90/binary>> = A. <<1,1,1,1,1 ... -5> byte_size(B). -10 -6> binary:referenced_byte_size(B) -100</code> - +5> {byte_size(B), binary:referenced_byte_size(B)}. +{10,10} +6> {byte_size(C), binary:referenced_byte_size(C)}. +{90,100}</code> + <p>In the above example, the small binary <c>B</c> was copied while the + larger binary <c>C</c> references binary <c>A</c>.</p> <note> <p>Binary data is shared among processes. If another process still references the larger binary, copying the part this |