Hi,

during mem leak search i found that dumping pool state is helpfull, so i cutted pool stat code into separate function

--
________________________________________
Maksym Veremeyenko
>From 5bc6ab0b476514744e9bedadd630b3fbcdbeb167 Mon Sep 17 00:00:00 2001
From: Maksym Veremeyenko <ve...@m1.tv>
Date: Tue, 4 Nov 2014 11:58:33 +0200
Subject: [PATCH] implement mlt_pool_stat

---
 src/framework/mlt.vers   |    1 +
 src/framework/mlt_pool.c |   25 ++++++++++++++++---------
 src/framework/mlt_pool.h |    1 +
 3 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/src/framework/mlt.vers b/src/framework/mlt.vers
index 7c4a22c..bf273b1 100644
--- a/src/framework/mlt.vers
+++ b/src/framework/mlt.vers
@@ -219,6 +219,7 @@ MLT_0.8.8 {
     mlt_pool_purge;
     mlt_pool_realloc;
     mlt_pool_release;
+    mlt_pool_stat;
     mlt_producer_attach;
     mlt_producer_clear;
     mlt_producer_close;
diff --git a/src/framework/mlt_pool.c b/src/framework/mlt_pool.c
index 1381dfb..a865757 100644
--- a/src/framework/mlt_pool.c
+++ b/src/framework/mlt_pool.c
@@ -389,19 +389,26 @@ void mlt_pool_release( void *release )
 void mlt_pool_close( )
 {
 #ifdef _MLT_POOL_CHECKS_
-	// Stats dump on close
-	int i = 0;
-	for ( i = 0; i < mlt_properties_count( pools ); i ++ )
+	mlt_pool_stat( );
+#endif
+
+	// Close the properties
+	mlt_properties_close( pools );
+}
+
+void mlt_pool_stat( )
+{
+	// Stats dump
+	int i = 0, c = mlt_properties_count( pools );
+
+	mlt_log( NULL, MLT_LOG_VERBOSE, "%s: count %d\n", __FUNCTION__, c);
+
+	for ( i = 0; i < c; i ++ )
 	{
 		mlt_pool pool = mlt_properties_get_data_at( pools, i, NULL );
 		if ( pool->count )
-			mlt_log( NULL, MLT_LOG_DEBUG, "%s: size %d allocated %d returned %d %c\n", __FUNCTION__,
+			mlt_log( NULL, MLT_LOG_VERBOSE, "%s: size %d allocated %d returned %d %c\n", __FUNCTION__,
 				pool->size, pool->count, mlt_deque_count( pool->stack ),
 				pool->count !=  mlt_deque_count( pool->stack ) ? '*' : ' ' );
 	}
-#endif
-
-	// Close the properties
-	mlt_properties_close( pools );
 }
-
diff --git a/src/framework/mlt_pool.h b/src/framework/mlt_pool.h
index da90ed4..c52f97a 100644
--- a/src/framework/mlt_pool.h
+++ b/src/framework/mlt_pool.h
@@ -30,5 +30,6 @@ extern void *mlt_pool_realloc( void *ptr, int size );
 extern void mlt_pool_release( void *release );
 extern void mlt_pool_purge( );
 extern void mlt_pool_close( );
+extern void mlt_pool_stat( );
 
 #endif
-- 
1.7.7.6

------------------------------------------------------------------------------
_______________________________________________
Mlt-devel mailing list
Mlt-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlt-devel

Reply via email to