From: Avdi Grimm Date: 2008-06-14T22:56:51+09:00 Subject: Re: raise and rescue On Sat, Jun 14, 2008 at 6:43 AM, Michael T. Richter wrote: > 3. The exception handler pops up a dialogue/prompt/whatever telling me that > memory is low. It suggests actions I can take to free up enough memory. > Let's say I choose to kill memory hogs like Firefox or OpenOffice.org. I > click "continue" (or type or whatever the UI is). > 4. The exception handler retries the very line of code that failed. All of > the expensive, time-consuming setup that led to that point is still there > and still ready for action. If you really must do this and you're using 1.8, just throw the current continuation up the stack, and then resume it when when the memory issue is theoretically resolved.. I'm not going to go into detail, though, because a) I don't have time; and b) I'm going to be very opinionated here and say you really ought to be looking into better architecting your system to deal with memory crunches without these contortions, if you actually expect to be running out of memory a lot. However, look up calcc, and have fun. -- Avdi Home: http://avdi.org Developer Blog: http://avdi.org/devblog/ Twitter: http://twitter.com/avdi Journal: http://avdi.livejournal.com