[Solar-talk] Memory problems

Paul M Jones pmjones at ciaweb.net
Tue Nov 13 07:56:53 CST 2007


On Nov 13, 2007, at 7:51 AM, Rodrigo Moraes wrote:

> On Nov 13, 2007 11:35 AM, Paul M Jones wrote:
>> * Problem: PHP's memory handling does not work well with parent/child
>> circular relationships.
>>
>> * Solution:  call $record->__destruct() manually, then unset 
>> ($record).
>>
>> Yes, this is tedious and inconvenient.  :-(
>
> Thanks. I tried to __destruct() / unset(), but the same happens.  Now,
> looking at the record class, it doesn't have a __destruct() method.
> Should it have something special there? My records *have* related
> records... I think I'm in a big trouble here and should change the
> initial plan and run the whole migration in steps... any advice?

Off the cuff:

* Make sure you destruct/unset the model class too, if it gets  
created inside the loop.

* Sounds like we need a __destruct() method for the record class that  
kills off child objects (like relateds, other models, etc).  Perhaps  
we need to go back through *all* the model classes and check for  
parent/child circular relationships.

* ... can't think of much else right now.  :-(




--

Paul M. Jones  <http://paul-m-jones.com>

Solar: Simple Object Library and Application Repository
for PHP5.  <http://solarphp.com>

Join the Solar community wiki!  <http://solarphp.org>

Savant: The simple, elegant, and powerful solution for
templates in PHP.  <http://phpsavant.com>




More information about the Solar-talk mailing list