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???
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.
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.