Re: out-of-memory [was Re: glib CVS ?]



On 26 Nov 2001 09:47:03 -0500
"Owen Taylor" <otaylor redhat com> wrote:

> glib-2.0 will provide two things to help here:
> 
>  - The ability to replace g_malloc and friends with your own 
>    functions that can take action to try to free up memory
>    on OOM.

And in case it could not ? 

>  - g_try_malloc() that can be used when the caller wants to handle
>    failure. For instance, GdkPixbuf uses g_try_malloc()
>    in case it is fed a huge image.

But we can't use g_try_malloc in GString since it is fixed.

>  - Recovering from OOM on a desktop system is not really
>    practical. Most likely, other components of the users desktop will
>    die and/or the machine will become unusuable before you have
>    anything to do with it.

Then, glib is only for desktop applications ...
and the design is not adapted to do system programming.

> Basically, if you want to recover from OOM, you need to make that a
> system design goal, and you have to know what needs to happen if you
> run out of memory at any one point and make sure that you stay in a
> consistent state on failure.

I still think that a program ending is not an option for me.

> With the GLib-2.0 changes we've tried to address this issue 
> as much as possible without causing ourselves nightmares.

Is the second version not an occasion to changes these stuff ?

I have to conclude that I have to use a more powerful library
in order to fit my needs.

-- 
DINH Viêt Hoà



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