Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

string.trim() causing outofmemoryerror?

 
Ankit Thakkar
Ranch Hand
Posts: 33
Android Java Mac PPC
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4181
21
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13056
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic