[erlang-questions] Erlang string datatype [cookbook entry #1 - unicode/UTF-8 strings]

Loïc Hoguin essen@REDACTED
Tue Oct 25 10:04:59 CEST 2011

On 10/25/2011 09:57 AM, Anthony Ramine wrote:
> Le 25 oct. 2011 à 06:57, Richard O'Keefe a écrit :
>>> 6) Ideally, reference count immutable string data so that substring extraction is cheap.
>> Java has cheap substring extraction without reference counting.
>> However, be aware that doing this can lead to *huge* space leaks with very
>> large source strings being retained for the sake of comparatively small
>> substrings; there is a *reason* why Java's immutable String class comes with a
>> copy() method!
> Don't we have the same problem with sub-binaries of large binaries?
> (Sorry for the dupe mail Richard, forgot to include the list)

And that's why binaries come with a binary:copy/1 function.

Loïc Hoguin

More information about the erlang-questions mailing list