Hi,

I have a question regarding Memory Leak. The below mentioned JSP code can generate any Out of memory exception

String str = tempStrView.getSTR();
String newStr = str+"'";
String rpcStr = " ";
String convStr = newStr.replaceAll("'",rpcStr);

Thanks in advance,

Vinith

Value of str will be a 16 digit number. For eaxmple

String str = 1234567887654321

Are you converting it to a number at any point or are you keeping is as a string throughout the program?

It is a String declaration through out the program. Its used for export the values to excel. 16 digit number will not export properly to excel . SO i have added ' and replacing the ' with blank space. Its working fine after this change. But this application showing out of memory exception some times.

If you are working exclusively wrt manipulating strings, use StringBuilder class for appending operations rather than concatenation for strings. If you still face memory issues, then they might just be valid reasons and would require you to set the heap size accordingly. What is your current heap size?

This question has already been answered. Start a new discussion instead.