Re: out-of-mem handler



Tim Janik <timj@gtk.org> writes: 
> would this be the callback itself?
> 
> if so, i'm not very fond of adding a g_malloc_failed() callback for this
> specific purpose (you'd need a similar thing for realloc as well). if that
> is really required, i'd rather have a pluggable table of malloc+realloc+free
> calls, that programs (ones that *really* need it) could plug into glib
> *before* doing any else stuff. (much like libc allowes
> "overloading" of its basic allocation functions.)

Except that the malloc() you'd want is just g_malloc() with this error
handler. I guess that the pluggable table is more flexible though, I
have no real objection to it.

> you are aware, that you need to do similar things at the malloc level
> as well then, to prevent it from failing in xlib etc., right?
> 

Yes, I know. I think even if you can't do this however, recovering
successfully some percentage of the time (when mem is exhausted in
glib) is still an improvement.

Havoc



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