Re: Proposal: g_set_out_of_mem_handler



Hi Owen,

> First, as neat as Sebastian's proposal is, I have to say that
> I like Havoc's ideas a lot more. They are much (much) simpler
> which is important, and are less likely to conflict with other
> systems that overload malloc(), or to run into portability
> problems. (After all GLib now works on Win32, BeOS, OpenVMS,
> and other such systems that I suspect don't even have brk().)

gmemres needn't be used, just like gmodule and gthread. Additionally there us
a brk emulation for win32 in malloc.c. It just an option, I wouldn't even call
it a suggested option. It's just there for those, who think they write perfect
software and the only situation to bring their programs down is out-of-mem ;-)

But I reiterate, a callback from g_malloc in out-of-mem will yield nothing but
trouble.

> In general, I think trying too hard on this issue is not a good idea;
> we are never going to get that absolute "robustness" that seem to
> drive the demand for this without completely rewriting GLib and GTK+
> to propagate errors everywhere. Which, along with being totally
> impractical at this point , I suspect would actually decrease the
> effective robustness of GTK+ by hiding many of the warnings you get
> now if you don't check errors.

Agreed.
 
> (And no, longjump() exceptions are not an answer ... without language
> support for stack frame cleanup, they are just a bad idea... not to
> mention what happens if you throw such an exception across 3d party
> code.)

Agreed.
 
> The simplicity of Havoc's suggestions allow us to meet some of
> the objections without falling over backwards to achieve the
> impossible.

It's simple, but in opinion its as good as no change to Glib, which I also
would feel very comfortable with.
 
Of course something like g_try_malloc and g_try_realloc is GOOD.
One might actually asked, why nobody else proposed it hitherto.

Bye,
Sebastian
-- 
Sebastian Wilhelmi                   |            här ovanför alla molnen
mailto:wilhelmi@ira.uka.de           |     är himmlen så förunderligt blå
http://goethe.ira.uka.de/~wilhelmi   |



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