freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] master 0fcf486: Improve memory debugging.


From: Werner LEMBERG
Subject: [freetype2] master 0fcf486: Improve memory debugging.
Date: Sun, 6 Oct 2019 15:13:10 -0400 (EDT)

branch: master
commit 0fcf486e0d6f3bb1cb17b6a6f00f651e21077dda
Author: Werner Lemberg <address@hidden>
Commit: Werner Lemberg <address@hidden>

    Improve memory debugging.
    
    * include/freetype/internal/ftmemory.h (FT_MEM_FREE): Use
    `FT_DEBUG_INNER' to set source code file name and line.
    
    * src/base/ftdbgmem.c (ft_mem_table_remove): Better formatting of
    tracing message.
---
 ChangeLog                            | 10 ++++++++++
 include/freetype/internal/ftmemory.h |  8 ++++----
 src/base/ftdbgmem.c                  |  6 ++++--
 3 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 1246f16..7536383 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2019-10-06  Werner Lemberg  <address@hidden>
+
+       Improve memory debugging.
+
+       * include/freetype/internal/ftmemory.h (FT_MEM_FREE): Use
+       `FT_DEBUG_INNER' to set source code file name and line.
+
+       * src/base/ftdbgmem.c (ft_mem_table_remove): Better formatting of
+       tracing message.
+
 2019-10-03  Werner Lemberg  <address@hidden>
 
        * src/sfnt/sfwoff2 (reconstruct_font): Fix reallocation.
diff --git a/include/freetype/internal/ftmemory.h 
b/include/freetype/internal/ftmemory.h
index 78bd3bc..f0891ae 100644
--- a/include/freetype/internal/ftmemory.h
+++ b/include/freetype/internal/ftmemory.h
@@ -153,10 +153,10 @@ extern "C++"
                                                (FT_Long)(size), \
                                                &error ) )
 
-#define FT_MEM_FREE( ptr )                \
-          FT_BEGIN_STMNT                  \
-            ft_mem_free( memory, (ptr) ); \
-            (ptr) = NULL;                 \
+#define FT_MEM_FREE( ptr )                                  \
+          FT_BEGIN_STMNT                                    \
+            FT_DEBUG_INNER( ft_mem_free( memory, (ptr) ) ); \
+            (ptr) = NULL;                                   \
           FT_END_STMNT
 
 #define FT_MEM_NEW( ptr )                        \
diff --git a/src/base/ftdbgmem.c b/src/base/ftdbgmem.c
index 55cd269..2599c9b 100644
--- a/src/base/ftdbgmem.c
+++ b/src/base/ftdbgmem.c
@@ -621,8 +621,10 @@
 
         if ( node->size < 0 )
           ft_mem_debug_panic(
-            "freeing memory block at %p more than once at (%s:%ld)\n"
-            "block allocated at (%s:%ld) and released at (%s:%ld)",
+            "freeing memory block at %p more than once\n"
+            "  at (%s:%ld)!\n"
+            "  Block was allocated at (%s:%ld)\n"
+            "  and released at (%s:%ld).",
             address,
             FT_FILENAME( _ft_debug_file ), _ft_debug_lineno,
             FT_FILENAME( node->source->file_name ), node->source->line_no,



reply via email to

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