Re: [gtk-list] Re: g_malloc() aborts when enough memory is notfound?



>This is why I don't think trying to be well behaved on
>out-of-memory is all that useful. Of course, if it helps
>the user to recover even 10% of the time, it may be worth
>supporting....

given that i broadly agree with the argument in Owen's message, I
would point out that you *can* catch SIGABRT yourself. Yes, its true
that you can't know for sure that you were sent it because of an out
of memory problem, but perhaps glib could just help with that:

   void 
   abort_handler (int sig)

   {
	if (glib_out_of_memory()) {
	   do_something_that_does_not_call_malloc_well_probably_anyway();
	   _exit (1);
	} else {
	   ... hmmm, why are we here ? ...
        }
   }

that is, glib should make it possible to determine that its last call
to malloc failed.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]