Re: what if g_strdup_printf() fails?
- From: Scott Barron <sb125499 ohiou edu>
- To: gtk-app-devel-list gnome org
- Subject: Re: what if g_strdup_printf() fails?
- Date: Sat, 14 Sep 2002 16:49:36 -0400
On Sat, Sep 14, 2002 at 09:56:50PM +0200, Remco Poelstra wrote:
Hi,
I want to use g_strdup_printf(), but what happens if there isn't enough
memory?
Does it return NULL or does it call abort() or something else? I couldn't
find it in the API reference.
Thanks in advance,
Remco Poelstra
--
Give a small boy a hammer and he will find that everything he encounters
needs pounding.
Looking through the source it looks like deep down inside it uses
malloc(). It looks like it goes through g_new() which uses g_malloc()
which uses the standard_malloc() set up in the glib_mem_vtable which
then calls malloc(). Looking at the source for g_malloc() you'll see
that if glib_mem_vtable.malloc() fails it posts a g_error() about it and
returns NULL. Please correct me if I'm off about any of this (using
2.0.6 sources).
-Scott
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]