Re: g_try_new and g_try_new0 + error reporting for g_object_set



Hi Jan,

the problem is not the OOM case. The problem is that the user may has entered a too large value for something and that is the base for an allocation. It is much better telling the user that this much memory can't be allocated, rather that just crash and loose the work of the user.

Stefan
Hi Stefan,

On Wed, 09 Mar 2005 02:21:16 +0900, Stefan Kost wrote:

Matthias Clasen wrote:

...

g_new and g_new0

...

I am aware that I can write my own. But if many people do that it might make
sense to have them in the lib.

What do other do in this case?


Nothing as general UNIX libraries applications incl. the Gnome ones do not
handle the OOM case at all and they are expected to crash on swap exhaustion.
At least Linux kernel will start killing the processes itself anyway.

And it does not make sense to precisely handle each OOM case properly in your
code as any other library you call and even any other process on the system
will crash or gets killed in such OOM case anyway.

You need to secure your UNIX system against OOM on per-fork/exec case (with
same recoveries/restarts), not per-alloc case.


Regards,
Lace
_______________________________________________
gtk-devel-list mailing list
gtk-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list




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