Author: dmeyer
Date: Wed Feb 22 09:05:33 2006
New Revision: 7924

Modified:
   trunk/core/src/conf.py
   trunk/ui/src/menu/menu.py

Log:
start garbage collector in Timer

Modified: trunk/core/src/conf.py
==============================================================================
--- trunk/core/src/conf.py      (original)
+++ trunk/core/src/conf.py      Wed Feb 22 09:05:33 2006
@@ -66,6 +66,7 @@
 import __builtin__
 import logging
 import gettext
+import gc
 
 # kaa imports
 from kaa.base.strutils import to_unicode as Unicode
@@ -73,6 +74,7 @@
 from kaa.base.strutils import ENCODING
 from kaa.base.config import Var, Group, Dict, List
 from kaa.base.config import Config as KaaConfig
+from kaa.notifier import Timer
 
 class Config(KaaConfig):
     def __init__(self, app, schema, desc=u'', name=''):
@@ -203,6 +205,22 @@
 __builtin__.__dict__['String']  = String
 
 
+def garbage_collect():
+    """
+    Run garbage collector. It is not nice that we have to do this,
+    but without we have a memory leak.
+    """
+    # run gc
+    gc.collect()
+    for g in gc.garbage:
+        # print information about garbage gc can't collect
+        logger.warning('Unable to free %s' % g)
+
+
+# start garbage_collect every 5 seconds
+Timer(garbage_collect).start(5)
+
+
 def cachefile(name, uid=False):
     """
     Return a cachefile based on the name. The result is an absolute path.

Modified: trunk/ui/src/menu/menu.py
==============================================================================
--- trunk/ui/src/menu/menu.py   (original)
+++ trunk/ui/src/menu/menu.py   Wed Feb 22 09:05:33 2006
@@ -219,11 +219,3 @@
         Delete function of memory debugging
         """
         log.info('Delete menu %s' % self.heading)
-        # run gc (for debugging)
-        gc.collect()
-        # check for more garbage
-        g = gc.collect()
-        if g:
-            log.warning('Garbage: %s' % gc.collect())
-            for g in gc.garbage:
-                log.warning(' %s' % g)


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to