Re: xmalloc string functions
- From: William Ahern <william@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 27 Jan 2008 14:55:32 -0800
Yevgen Muntyan <muntyan@xxxxxxxxxxxxxxxxxxx> wrote:
William Ahern wrote:
Yevgen Muntyan <muntyan@xxxxxxxxxxxxxxxxxxx> wrote:
Malcolm McLean wrote:
Here are six functions implemented on top of xmalloc(). No C programmer
should have any triouble providing the implemetations, though replace
and getquote are non-trivial.
[snip]
I've think we've got something quite powerful here, purely because none
of these functions can ever return null for out of memory conditions. It
massively simplifies string handling.
Take a look at glib,
http://library.gnome.org/devel/glib/2.14/glib-Memory-Allocation.html
glib is where bad ideas go to die. Now, if somebody just had the nerve to
tell them....
There are at least two desktop environments built on glib, and
bunch of independent applications, and they actually work. Have
you got something more substantial than "bad ideas"?
I only brought it up because glib uses an xmalloc() wrapper which dies on
allocation failure, and Evolution and similar glib-based applications loved
to crash when, for instance, I would [try to] open a message with an
especially long marked-up diff. Of course, it was worse (as in more
frequent) before I disabled the Linux OOM killer. Never infrequent enough,
however.
In my experience, glib-based applications "mostly" work. Not sure whether
that has more to do w/ the xmalloc() wrapper, or other issues. I'll grant
you that the organization and design of glib source interfaces is... a
matter of taste.
One of my rules of thumb is that if a network daemon uses glib, I
automatically exclude it from consideration. I can deal when an application
crashes and destroys my work. I don't want to be responsible for installing
an application which crashes and destroys or interrupts _other_ people's
work.
.
- Follow-Ups:
- Re: xmalloc string functions
- From: Yevgen Muntyan
- Re: xmalloc string functions
- References:
- xmalloc string functions
- From: Malcolm McLean
- Re: xmalloc string functions
- From: Yevgen Muntyan
- Re: xmalloc string functions
- From: William Ahern
- Re: xmalloc string functions
- From: Yevgen Muntyan
- xmalloc string functions
- Prev by Date: Re: Thoughts on file organisation
- Next by Date: Re: Thoughts on file organisation
- Previous by thread: Re: xmalloc string functions
- Next by thread: Re: xmalloc string functions
- Index(es):