Re: glib CVS ?



Hi,

"DINH V. Hoa" <dinh viet hoa free fr> writes:

> On 24 Nov 2001 16:27:21 +0100
> Sven Neumann <sven gimp org> wrote:
> 
> > there (sort of) is handling for memory allocation errors built into
> > the glib g_malloc() function: if the malloc fails the application
> > exists with a fatal error. Thus there is no need to check the return
> > value of g_malloc() and friends (g_new, ...).
> 
> is this a good choice to result with a fatal error in the application
> whenever a memory allocation problem happens ? 
> Could I build a patch around it if ever it happens ?

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.


Salut, Sven



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