freetype-devel
[Top][All Lists]
Advanced

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

Re: Obj: FTLayout (was Re: Short Roadmap)


From: David Turner
Subject: Re: Obj: FTLayout (was Re: Short Roadmap)
Date: Mon, 23 Oct 2000 10:53:26 +0200

Salut Sven,

Sven Neumann a écrit :
> 
> Hi,
> 
> David Turner <address@hidden> writes:
> 
> >   Pango uses the "GLib" library, which provides a "checked"
> >   malloc that simply _traps_ the program/application when
> >   an out of memory condition is raised.
> >
> >   that's of course a major convenience when writing client
> >   applications that must run on a PC with plenty of swap space,
> >   given that never checking memory allocation _greatly_ simplifies
> >   C code. However, it's a major disaster when you need to write
> >   a system-level library that should _never_ crash your system
> >   or graphics server..
> 
> wouldn't it be a good idea to change glib so that it would allow the
> application to specify an error handler for the out of memory
> situation which overides the default behaviour (to quit with an error
> message) ? GLib-2.0 is still under active development and I think it
> might still be early enough to suggest such a change.
> 
> It would be a shame if Pange and similar software would have to be
> rewritten only because of the malloc routines in glib. I have
> looked into the glib code and it looks like the suggested change
> would be trivial to implement. What do you think?
> 

Adding an error handler is the "easy" part of the job. It's _how_ you
handle the error that is difficult to know and implement in a reliable
way, especially when your application uses libraries with static
variables that might be in an inconsistent state when the exception
occurs (as a simple example: what if the error happens within a
mutex enter/leave section ??, there are plenty of places in GLib
itself where this could happen..).

My opinion is that if the library isn't designed to be reliable from the
start, there's no way to "bend" it artificially to that condition..
actually, languages like Ada or Eiffel certainly weren't designed by
accident ;-)

I'd be interested in discussing these issues in more details, but perharps
in a GLib-specific mailing list instead, or on IRC.. let me know in
case you're interested :-)

Regards,

- David



reply via email to

[Prev in Thread] Current Thread [Next in Thread]