java.lang.OutOfMemoryError: Java heap space
I'm working with a small application that runs multiple threads and potentially can get caught up in a very deep recursive process...
Everything works fine and, obviously, as the recursion gets deeper the execution time is increased...
Each time the recursive method is called it sends output to a text area that can be saved at the users request.
Once the program fills the text area with approximately 212000 lines it crashes and gives me a
Code:
java.lang.OutOfMemoryError: Java heap space
Is there a way I can monitor the Heap space being used (in real time) and detect when it reaches a certain point and have things fail a little more gracefully?
Upon "googling" for a solution I came across this page which gives an example of a OutOfMemoryError Warning System. This sounds like exactly what I am looking for but I can not get it to work for me...it's not much of a tutorial.
Thanks