[glib/fix-gnulib-msvc-isnan: 12/37] gmem: Improve documentation to clarify abort-on-alloc-failure
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/fix-gnulib-msvc-isnan: 12/37] gmem: Improve documentation to clarify abort-on-alloc-failure
- Date: Tue, 9 Jun 2020 10:22:10 +0000 (UTC)
commit d56259c191b78a96ddda7e9d736ab8be5b324bfd
Author: Philip Withnall <withnall endlessm com>
Date: Tue May 19 15:12:16 2020 +0100
gmem: Improve documentation to clarify abort-on-alloc-failure
Clarify that it applies to everything.
Signed-off-by: Philip Withnall <withnall endlessm com>
Fixes: #176
glib/gmem.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/glib/gmem.c b/glib/gmem.c
index 88af5d805..605eac1ff 100644
--- a/glib/gmem.c
+++ b/glib/gmem.c
@@ -66,11 +66,15 @@ static GMemVTable glib_mem_vtable = {
* If any call to allocate memory using functions g_new(), g_new0(), g_renew(),
* g_malloc(), g_malloc0(), g_malloc0_n(), g_realloc(), and g_realloc_n()
* fails, the application is terminated. This also means that there is no
- * need to check if the call succeeded. On the other hand, g_try_...() family
+ * need to check if the call succeeded. On the other hand, the `g_try_...()` family
* of functions returns %NULL on failure that can be used as a check
* for unsuccessful memory allocation. The application is not terminated
* in this case.
*
+ * As all GLib functions and data structures use `g_malloc()` internally, unless
+ * otherwise specified, any allocation failure will result in the application
+ * being terminated.
+ *
* It's important to match g_malloc() (and wrappers such as g_new()) with
* g_free(), g_slice_alloc() (and wrappers such as g_slice_new()) with
* g_slice_free(), plain malloc() with free(), and (if you're using C++)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]