Can anyone help me in suggesting how to prevent "out of memory" exception in java. I am getting this exception when I load a very large data in my application and after running the application for sometime the application throws this exception. I want to know if there is any way (such as some parellel thread) that will keep a check for the maximum memory and when the application crosses some threshold (set manually) it will show some popup and exit instead of hanging the application.
Please suggest.