[glib: 1/2] gmem: clarify that g_malloc always uses the system allocator



commit 1f24b36607bf708f037396014b2cdbc08d67b275
Author: Daniel P. Berrangé <berrange redhat com>
Date:   Thu Sep 5 14:37:54 2019 +0100

    gmem: clarify that g_malloc always uses the system allocator
    
    Support for custom allocators was dropped in
    
      commit 3be6ed60aa58095691bd697344765e715a327fc1
      Author: Alexander Larsson <alexl redhat com>
      Date:   Sat Jun 27 18:38:42 2015 +0200
    
        Deprecate and drop support for memory vtables
    
    The introductory doc text for the gmem APIs still warns against mixing
    malloc/free with g_malloc/g_free. Clarify upfront in the docs that these
    two sets of APIs are now guaranteed to use the same memory allocator &
    can thus their usage can be freely mixed.
    
    Signed-off-by: Daniel P. Berrangé <berrange redhat com>

 glib/gmem.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/glib/gmem.c b/glib/gmem.c
index 09cd04140..88af5d805 100644
--- a/glib/gmem.c
+++ b/glib/gmem.c
@@ -77,6 +77,9 @@ static GMemVTable glib_mem_vtable = {
  * new with delete and new[] with delete[]. Otherwise bad things can happen,
  * since these allocators may use different memory pools (and new/delete call
  * constructors and destructors).
+ *
+ * Since GLib 2.46 g_malloc() is hardcoded to always use the system malloc
+ * implementation.
  */
 
 /* --- functions --- */
@@ -457,7 +460,7 @@ g_try_realloc_n (gpointer mem,
  * 
  * Checks whether the allocator used by g_malloc() is the system's
  * malloc implementation. If it returns %TRUE memory allocated with
- * malloc() can be used interchangeable with memory allocated using g_malloc().
+ * malloc() can be used interchangeably with memory allocated using g_malloc().
  * This function is useful for avoiding an extra copy of allocated memory returned
  * by a non-GLib-based API.
  *


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