Memory limit
Posted: Tue Mar 18, 2008 7:10 am
I am running a script that is eating up 200M of memory per load. This seams like a lot to me but I can't see how I can slim this code up. I was wondering if this 200M is too much or not? This kind of page is not hit by anyone than our employees (6 total) and its not hit very often. Basically, I am grabbing over 70 thousand rows from a table and fixing up the data. Basically this is my code thats crushing memory:
Is just increasing the amount of memory to be used a good idea or is there another way to do this?
Code: Select all
$raketrackingSelect = $this->RAKETRACKING->getAdapter()->select()
->from(
array(
'rt' => 'rb_raketracking',
)
)
->joinLeft(
array(
'um' => 'rb_usermap',
),
'rt.fk_room_id = um.fk_room_id AND rt.room_username = um.room_username',
array(
'usermap_id' => 'id',
)
)
->where('rt.fk_room_id = ?', $roomId)
->where('rt.data_date LIKE ?', new Zend_Db_Expr('"'.$selectedMonth.'%"'));
$raketracking = $this->RAKETRACKING->getAdapter()->query($raketrackingSelect)->fetchAll();
$usermapContent = array();
foreach ($raketracking as $val)
{
if (empty($usermapContent[$val->room_username]))
{
$usermapContent[$val->room_username] = array(
'username' => $val->room_username,
'grossRake' => 0,
'deductions' => 0,
'deductionsStyle' => '',
'netRake' => 0,
'points' => 0,
'rakeback' => 0,
'rakebackPercent' => 0,
'updated' => false,
);
}
$usermapContent[$val->room_username] = Functions::calculateRakebackData(Functions::getRoomNameBasedOnId($roomId), $selectedMonth, $val, $usermapContent[$val->room_username], $this->RAKETRACKING);
$usermapContent[$val->room_username]['usernameStyle'] = ($val->usermap_id ? 'color: black;' : 'color: red;');
}