No, that does not solve the problem. Consider this Java fragment:<p><pre><code>   String someLargeString = ...;
   &#x2F;&#x2F;...
   String interesting = someLargeString.substring(10, 20);
   someLargeString = null;
</code></pre>
Now assume that <i>someLargeString</i> is garbage-collected after the last statement. Is the backing character array of <i>interesting</i> 10 <i>char</i>s long or the size of the backing array of <i>someLargeString</i>?<p>You don&#x27;t know, unless you know what the implementation of <i>String#substring</i> does. Suppose that <i>someLargeString</i>&#x27;s array was a couple of megabytes, you could be using 20 bytes of memory or megabytes for <i>interesting</i>.<p>(Note that in the case of Java they switched from a O(1) index-based slicing to O(n) copying some time ago.)