Re: g_*printf() (Was: gtk+-1.1.6 report)



Hi, Aaron 

> > > Along these lines, I'd suggest a "out-of-memory" hook. The standard 
> > > hook
> > > should abort the program. The reason behind this is that the program
> > > should print a meaningful error when it runs out of memory but most 
> > > people
> > > don't want to add a check after every invokation of g_printf_new().
> > > (and that should be g_sprintf_new() :-)
> > As mentioned earlier, g_strdup_printf does, what is wanted, as for the
> > hook, glib never returns on memory errors, but simply aborts. As I tried
> > to explain earlier, this is a good thing (i.e. to simply abort and not
> > provide a callback in case of memory shortage; see thread "[gtk-list]
> > 1.1.5 g_timer_new bug!")
> 
> Does that mean one can't write reliable applications with GLib/Gtk ?

Depends on, what you call reliable. I personally do not believe in people
saying, they can handle a out-of-memory errors. I think, thats not
possible. on the other hand, you can easily 'overload' (i.e. provide own
versions of malloc in a library linked with as the last libraries) the
malloc function with the requested behavior, that is it always returns
memory ;-). 

Bye,
Sebastian
-- 
+--------------============####################============--------------+
| Sebastian Wilhelmi, Institute for Computer Design and Fault Tolerance, |
| University of Karlsruhe;  Building 20.20, Room 263,  D-76128 Karlsruhe |
| mail: wilhelmi@ira.uka.de;  fax: +49 721 370455;  fon: +49 721 6084353 |
+-----------------> http://goethe.ira.uka.de/~wilhelmi <-----------------+



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