How memory leak fixed in JDK1.7?


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);
}

This entry was posted in JAVA and tagged on by .
Rahul Thakur

About Rahul Thakur

Hi, this is Rahul working as Software Engineer at Orange Business Services. Responsible for Requirement analysis, design ,development, deployment, and testing. Working on Agile methodology and Scrum Experience on UML, OOAD, OOPS, Design patterns, Java / J2ee technologies, ORM, performance and load tests, code review and lot of SDLC activities.