Java moves to copying for substrings
Walter Bright
newshound2 at digitalmars.com
Tue Nov 19 13:49:01 PST 2013
On 11/18/2013 11:36 PM, monarch_dodra wrote:
> On Tuesday, 19 November 2013 at 05:38:14 UTC, Jesse Phillips
> wrote:
>> So apparently substrings were considered a common cause of memory leaks.
>
> I think it is pretty important to remember that slicing, while
> giving you a small view, still holds the entire array.
>
> I think there is nothing wrong with pipping a ".dup" every now
> and then, after slicing something.
And D gives you that choice. You can "slice & hold" or "slice & dup". Your
choice, as the circumstances dictate.
With Java, there is no choice, and they are stuck with one size fits all.
More information about the Digitalmars-d
mailing list