Re: glib CVS ?
- From: Tim Janik <timj gtk org>
- To: "DINH V. Hoa" <dinh viet hoa free fr>
- Cc: Gtk+ Developers <gtk-devel-list gnome org>
- Subject: Re: glib CVS ?
- Date: Sun, 25 Nov 2001 23:09:29 +0100 (CET)
On Sat, 24 Nov 2001, DINH V. Hoa wrote:
> On 24 Nov 2001 17:08:45 +0100
> Sven Neumann <sven gimp org> wrote:
>
> > you could plug your own memory allocation routines into the glib memory
> > system (it has hooks that allow you to do so without patching). It will
> > be non-trivial however to gracefully recover from a failed memory
> > allocation. Glib-2.0 has g_try_malloc() that you can use in your own
> > routines wherever it makes sense.
>
> GString should be changed in order to use these
> g_try_realloc/g_try_malloc in order to recover from failed memory
> allocation, don't you think so ?
nope, GString's API doesn't have any provisions for reporting errors
ala "don't use me i couldn't allocate enough memory".
a good example of where g_try_malloc() is apropriate is the pixbuf
loading code, where out-of-mem is just another error condition
besides various other reasons for why an image couldn't get loaded,
and the allocation failing my very well be due to a broken image
file (say it told you to allocater space for 65535*65535 pixels).
---
ciaoTJ
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]