[Solar-talk] Memory problems

Rodrigo Moraes rodrigo.moraes at gmail.com
Tue Nov 13 07:28:11 CST 2007


Hmm, I'm running into memory problems trying to migrate a database
using the model (using cli). But I'm really not sure if it is model
related.

The script is basically as follow:

    $select = Solar::factory('Solar_Sql_Select');
    $res = $select->from('table')->fetch('all');

    $model = Solar::factory('My_Model);

    foreach($res as $data) {
        $record = $model->fetchNew();
        $record->foo = 'bar';

        try {
            $record->save();
        } catch(Solar_Exception $e) {
            throw $e;
        }
    }

After a while: "Fatal Error: Allowed memory size of 268435456 bytes
exhausted (tried to allocate 40 bytes) in ..."

I tried to unset($record) after save(), but the same happens - it dies
after about 5 thousand records.

So, should I do it differently? Can I count with cli for this? :-|

-- rodrigo


More information about the Solar-talk mailing list