This issue is fixed in JDK1.7 by using the Array.copyOfRange() method like as follows: It keeps only the substring array, and free the other original string.
public String substring(int beginIndex, int endIndex) { return new String(value, beginIndex, endIndex - beginIndex); } public String(char value[], int offset, int count) { this.value = Arrays.copyOfRange(value, offset, offset + count); }