[891] in BarnOwl Developers

home help back first fref pref prev next nref lref last post

[D-O-H] r878 - branches/barnowl_sqlite/owl

daemon@ATHENA.MIT.EDU (nelhage@MIT.EDU)
Thu Oct 29 18:10:50 2009

Resent-From: nelhage@mit.edu
Resent-To: barnowl-dev-mtg@charon.mit.edu
To: dirty-owl-hackers@mit.edu
From: nelhage@MIT.EDU
Reply-to: dirty-owl-hackers@MIT.EDU
Date: Tue, 15 Jan 2008 16:49:21 -0500 (EST)

Author: nelhage
Date: 2008-01-15 16:49:20 -0500 (Tue, 15 Jan 2008)
New Revision: 878

Modified:
   branches/barnowl_sqlite/owl/messagelist.c
   branches/barnowl_sqlite/owl/owl.c
   branches/barnowl_sqlite/owl/perlconfig.c
Log:
Make SVs returned by the messagelist mortal and clean them up in the main loop. We _should_ no longer leak messages.

Modified: branches/barnowl_sqlite/owl/messagelist.c
===================================================================
--- branches/barnowl_sqlite/owl/messagelist.c	2008-01-15 21:25:01 UTC (rev 877)
+++ branches/barnowl_sqlite/owl/messagelist.c	2008-01-15 21:49:20 UTC (rev 878)
@@ -42,7 +42,7 @@
                        msg = POPs;
                        if(SvROK(msg)) SvREFCNT_inc(msg);
                        );
-  return SvROK(msg) ? msg : NULL;
+  return SvROK(msg) ? sv_2mortal(msg) : NULL;
 }
 
 owl_message *owl_messagelist_get_by_id(owl_messagelist *ml, int target_id)
@@ -56,7 +56,7 @@
                        msg = POPs;
                        if(SvROK(msg)) SvREFCNT_inc(msg);
                        );
-  return SvROK(msg) ? msg : NULL;
+  return SvROK(msg) ? sv_2mortal(msg) : NULL;
 }
 
 void owl_messagelist_append_element(owl_messagelist *ml, owl_message *msg)

Modified: branches/barnowl_sqlite/owl/owl.c
===================================================================
--- branches/barnowl_sqlite/owl/owl.c	2008-01-15 21:25:01 UTC (rev 877)
+++ branches/barnowl_sqlite/owl/owl.c	2008-01-15 21:49:20 UTC (rev 878)
@@ -419,6 +419,8 @@
   /* main loop */
   while (1) {
 
+    owl_perl_savetmps();
+
     /* if a resize has been scheduled, deal with it */
     owl_global_resize(&g, 0, 0);
 
@@ -580,6 +582,8 @@
       }
     }
 
+    owl_perl_freetmps();
+
   }
 }
 

Modified: branches/barnowl_sqlite/owl/perlconfig.c
===================================================================
--- branches/barnowl_sqlite/owl/perlconfig.c	2008-01-15 21:25:01 UTC (rev 877)
+++ branches/barnowl_sqlite/owl/perlconfig.c	2008-01-15 21:49:20 UTC (rev 878)
@@ -390,3 +390,13 @@
                        );
   return obj;
 }
+
+void owl_perl_savetmps() {
+  ENTER;
+  SAVETMPS;
+}
+
+void owl_perl_freetmps() {
+  FREETMPS;
+  LEAVE;
+}


home help back first fref pref prev next nref lref last post