speechd-discuss
[Top][All Lists]
Advanced

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

memory allocation clarification


From: Chris Brannon
Subject: memory allocation clarification
Date: Mon, 22 Feb 2010 05:33:48 -0600

Jose Vilmar Estacio de Souza wrote:
> Yes, in attach to this message.
> Basicly the patch tries to replace all class to malloc and free, for 
> g_malloc and g_free. Some calls to strdup were replace for g_strdup.

Hi Jose,
Thanks.  Sorry it took me a while to reply.
You have the right idea.

I'm not sure about changing xmalloc, xrealloc,
and xfree so that they call glib's allocation functions.  Those are wrappers
around the libc routines.  I'm inclined to leave them alone, just for
the sake of code readability.
Realize that glib's allocation functions don't need to be wrapped, since
they already abort the program on allocation failure.
Perhaps it's better to just change the call sites to g_malloc, where needed?

I would leave getline alone as well.  That needs to use libc's malloc.
GNU's libc provides getline for most of us,
and that version uses malloc internally.
The getline defined in module_utils.c is provided for Solaris.  Evidently,
they don't link against GNU's libc.

I'll try to send a patch later, and I'll give you credit for your work in
the commit message.

-- Chris



reply via email to

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