[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
- [PATCH] Corrected some memory leacs in src/tests/run_test.c, (continued)
- [PATCH] Corrected some memory leacs in src/tests/run_test.c, Rui Batista, 2010/02/16
- memory allocation clarification, jose vilmar estacio de souza, 2010/02/17
- memory allocation clarification, Luke Yelavich, 2010/02/17
- memory allocation clarification, jose vilmar estacio de souza, 2010/02/18
- memory allocation clarification, Chris Brannon, 2010/02/19
- memory allocation clarification, jose vilmar estacio de souza, 2010/02/20
- memory allocation clarification, Chris Brannon, 2010/02/20
- memory allocation clarification, jose vilmar estacio de souza, 2010/02/20
- memory allocation clarification,
Chris Brannon <=
- memory allocation clarification, jose vilmar estacio de souza, 2010/02/22