This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Java in General and the fly likes string.trim() causing outofmemoryerror? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "string.trim() causing outofmemoryerror?" Watch "string.trim() causing outofmemoryerror?" New topic
Author

string.trim() causing outofmemoryerror?

Ankit Thakkar
Ranch Hand

Joined: Apr 29, 2005
Posts: 33

Dear All,

we are facing outofmemory in production environment with jboss. we allocated 2 GB. we are having some owkward issue.
when this error comes up specific functionality doesn't work. but still users are able to access different functionality.
we noticed that when we have nullpointer exception in string.trim() or patter.compile() at this time we are getting outofmemoryerror.

if one user get outofmemoryerror other can still try with different functionality.

is there any possibility that string.trim for null value cause this error???

please help
thanks
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4181
    
  21

Well, there are too many unknowns to be sure, but it seems to me like the problem may come from your error reporting. The only way to be sure would be to profile the application and see what is consuming so much memory.


Steve
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12809
    
    5
is there any possibility that string.trim for null value cause this error?


Trying to execute trim() on a String reference that is actually null will of course cause a NullPointerException which would only consume memory to build the stack trace. Not a very large amount of memory involved, look elsewhere.

Bill

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: string.trim() causing outofmemoryerror?