[vlc-devel] [PATCH 3/3] libvlc: add leak debugging code

Steve Lhomme robux4 at ycbcr.xyz
Tue Mar 12 09:24:56 CET 2019


disabled by default
---
 src/libvlc.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/libvlc.c b/src/libvlc.c
index 8200f81d9e..a9f39e9837 100644
--- a/src/libvlc.c
+++ b/src/libvlc.c
@@ -450,6 +450,16 @@ void libvlc_InternalDestroy( libvlc_int_t *p_libvlc )
 
     vlc_ExitDestroy( &priv->exit );
 
+#if 0
+    {
+        vlc_object_internals_t *internal = vlc_internals(p_libvlc);
+        if (atomic_load(&internal->refs) != 1)
+        {
+            fprintf(stderr, "=== vlc_object LEAKS detected ===\n");
+            DumpStructure(VLC_OBJECT(p_libvlc), stderr, 1, false);
+        }
+    }
+#endif
     assert( atomic_load(&(vlc_internals(p_libvlc)->refs)) == 1 );
     vlc_object_delete(p_libvlc);
 }
-- 
2.17.1



More information about the vlc-devel mailing list