]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Add destructor on Memcached_DataObject to free DB_DataObject's global storage for...
authorBrion Vibber <brion@status.net>
Tue, 15 Dec 2009 00:36:01 +0000 (16:36 -0800)
committerBrion Vibber <brion@status.net>
Tue, 15 Dec 2009 00:36:01 +0000 (16:36 -0800)
Reduces some, but not all, memory leakage for long-running processes.

classes/Memcached_DataObject.php

index 753fe954e06495a231776d3f50fce09b7930ba95..8fdb56088b94642a16108e802dac25b34882ae65 100644 (file)
@@ -23,6 +23,17 @@ require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
 
 class Memcached_DataObject extends DB_DataObject
 {
+    /**
+     * Destructor to free global memory resources associated with
+     * this data object when it's unset or goes out of scope.
+     * DB_DataObject doesn't do this yet by itself.
+     */
+    function __destruct()
+    {
+        $this->free();
+        parent::__destruct();
+    }
+
     function &staticGet($cls, $k, $v=null)
     {
         if (is_null($v)) {