开发者

Where is my memory leak in this Doctrine 1.2 code?

开发者 https://www.devze.com 2023-01-17 08:50 出处:网络
I am trying to reduce my memory usage on a large loop script so I made this little test. Using Doctrine I run this code:

I am trying to reduce my memory usage on a large loop script so I made this little test. Using Doctrine I run this code:

$new_user_entry = getById($new_user_entries[0]['id']);
unset($new_user_entry);

$new_user_entry = getById($new_user_entries[1]['id']);
unset($new_user_entry);

function getById($holding_id)
{
    return Doctrine_Core::g开发者_如何学PythonetTable('UserHoldingTable')->findOneById($holding_id);
}

But it leaves about another 50 KB in the memory for each time I do the getById and unset and I don't know why or how to change it. I have a loop that goes through thousands of these plus a couple other functions and this is creating an issue.


I was unable to find a better solution so I gave up on Doctrine for this function and did a manual query with mysqli. This side stepped the issue and everything worked though not ideal.

0

精彩评论

暂无评论...
验证码 换一张
取 消