[RFC] What to do on VM exhaustion

Michael Snyder
2006-01-05T01:00:00Z

Hey folks,

I don't know how many of you may have ever run into this situation,
but my question is, what should we do in gdb when we detect that
we are dead out of memory?

Theoretically it's handled -- there is a routine in utils.c called
"nomem", which calls internal_error. The problem is that internal_error
isn't a simple bailout -- it calls query to ask the user what s/he
wants to do. And you can't count on something like that working,
when you are out of virtual memory.

I actually ran into this once before, years ago -- in fact it was
RMS himself who called me to beef about gdb bailing on him, when
he was debugging emacs and crashed the stack with an infinite
recursion. I think gdb ran out of memory while trying to do a
backtrace. He wanted me to make it recover gracefully and let him
keep debugging. I couldn't do it, but then I didn't have the
luxury of having all you guys to ask for advice!

In present time, I'm suggesting that nomem should just write
a simple error msg to the console and abort. What do you think?