From ac8c536b50a9e80a18c233f1dd9948578c2aa071 Mon Sep 17 00:00:00 2001 From: Pablo Polvorin Date: Fri, 9 Nov 2012 16:57:23 -0300 Subject: Improvement Force the binary to be a heap binary, rather than keeping it as a refcount or sub-binary --- src/stringprep/stringprep.erl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/stringprep/stringprep.erl b/src/stringprep/stringprep.erl index 9458af58e..8bbc5d213 100644 --- a/src/stringprep/stringprep.erl +++ b/src/stringprep/stringprep.erl @@ -101,5 +101,8 @@ resourceprep(String) -> control(Command, String) -> case port_control(?STRINGPREP_PORT, Command, String) of <<0, _/binary>> -> error; - <<1, Res/binary>> -> Res + <<1, Res/binary>> -> binary:copy(Res) + %% Result is usually a very small binary, that fit into a heap binary. + %% binary:copy() ensure that's the case, instead of keeping a subbinary or + %% refcount binary around end. -- cgit v1.2.3