[Solar-svn] Revision 3205
pmjones at solarphp.com
pmjones at solarphp.com
Fri Jun 6 15:34:49 CDT 2008
Solar_Sql_Model_Record: [FIX] In method load(), when loading related models, free the model object to avoid memory leaks. Thanks, Nicholas Sloan, for the report that led to this fix.
Modified: trunk/Solar/Sql/Model/Record.php
===================================================================
--- trunk/Solar/Sql/Model/Record.php 2008-06-06 19:13:02 UTC (rev 3204)
+++ trunk/Solar/Sql/Model/Record.php 2008-06-06 20:34:49 UTC (rev 3205)
@@ -346,6 +346,9 @@
));
$this->_data[$name] = $model->newRecord($load[$name]);
+ // free the model so we don't get memory leaks
+ $model->free();
+
} elseif ($type == 'has_many' && ! empty($load[$name])) {
// create a collection object from the related model
@@ -354,6 +357,9 @@
));
$this->_data[$name] = $model->newCollection($load[$name]);
+ // free the model so we don't get memory leaks
+ $model->free();
+
} elseif (! array_key_exists($name, $this->_data)) {
// set a placeholder for lazy-loading in __get()
$this->_data[$name] = null;
More information about the Solar-svn
mailing list