aspose file tools*
The moose likes Java in General and the fly likes OutOfMemory error QUESTION Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "OutOfMemory error QUESTION" Watch "OutOfMemory error QUESTION" New topic
Author

OutOfMemory error QUESTION

hallian
Greenhorn

Joined: Sep 04, 2002
Posts: 4
Hi,
I have seven to ten threads running at a time in my Application. Some database processing is done in each Thread and time it takes to finish is different for each Thread. I have ProgressBar for each Thread to keep track of when the Thread completes and shows a message on the ProgressBar saying Thread finished . Now my problem is if any Thread throws OutOfMemory error then all my threads keep going but never finishes means it goes in some kind of continuous looping effect. And my ProgressBars keeps going forever. Now my question is
Is there a nice way to catch this error and do some clean up and kill a Thread while letting other Threads to keep continue and finish properly.
What happens to a Thread if OutOfMemory error occurs. Thanks for any tips and help.
Doanh Nguyen
Ranch Hand

Joined: Dec 02, 2000
Posts: 45
Originally posted by hallian:
Is there a nice way to catch this error and do some clean up and kill a Thread while letting other Threads to keep continue and finish properly.

To me an out-of-memory error implies a logic error. Without any memory left, JVM will crash because there is nothing left to run. Instead of catching it and ignoring it, I would try to fix the cause.
If the cause is the number of threads generated then you can increase memory or limit the threads.
Originally posted by hallian:
What happens to a Thread if OutOfMemory error occurs.

Will it be captured by UFO?
[ September 24, 2002: Message edited by: Doanh Nguyen ]
Sean MacLean
author
Ranch Hand

Joined: Nov 07, 2000
Posts: 621
"hallian",
Thanks for participating here at the Ranch. However, the name you are using does not comply with our naming convention described at http://www.javaranch.com/name.jsp . Please log in with a new name, which meets these requirements.
You can change your name here.
Thanks.
Sean
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: OutOfMemory error QUESTION