[vlc-commits] commit: luasd: Force a garbage collect at the end of Run(). (Pierre d' Herbemont )

git version control git at videolan.org
Fri Mar 5 11:06:29 CET 2010


vlc | branch: master | Pierre d'Herbemont <pdherbemont at free.fr> | Fri Mar  5 11:01:32 2010 +0100| [503a7851c50a83d1249528787929afeea3b81c93] | committer: Pierre d'Herbemont 

luasd: Force a garbage collect at the end of Run().

Generally the core won't call Close() until the end of vlc's life. Hence
it's our last chance to gc collect before the end of vlc's life.

This gets important because some sd (freebox...) will open a vlc.stream
which (and that's an other issue) will eat 12MB at creation for a cache
that will never be completely filed. It also mean that if you vlc.stream
N small files, we may consume N * 12MB until finally lua decides to garabge
collect. And because we don't teach lua that vlc.stream takes 12MB this
is not likely to happen.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=503a7851c50a83d1249528787929afeea3b81c93
---

 modules/misc/lua/services_discovery.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/modules/misc/lua/services_discovery.c b/modules/misc/lua/services_discovery.c
index 0b33f93..6dcbc4a 100644
--- a/modules/misc/lua/services_discovery.c
+++ b/modules/misc/lua/services_discovery.c
@@ -172,5 +172,10 @@ static void* Run( void *data )
         return NULL;
     }
     msg_Dbg( p_sd, "LuaSD script loaded: %s", p_sys->psz_filename );
+
+    /* Force garbage collection, because the core will keep the SD
+     * open, but lua will never gc until lua_close(). */
+    lua_gc( L, LUA_GCCOLLECT, 0 );
+
     return NULL;
 }



More information about the vlc-commits mailing list