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

Steve Lhomme robux4 at ycbcr.xyz
Wed Mar 13 09:01:18 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..a140aa3c00 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");
+            DumpStructureLocked(VLC_OBJECT(p_libvlc), stderr, 0);
+        }
+    }
+#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