Web服务器内存泄漏问题

时间:2012-06-27 18:14:36

标签: memory symfony1 webserver

我正在使用symfony 1.4创建一个约会网站(这是我使用symfony的第一个项目)。问题是,如果只有10个或更少的用户在线,服务器会冻结。我尝试使用yslow优化我的js,css,sprites我得到了A级,但问题仍然存在。这就是为什么我认为我构建应用程序的方式可能是错误的所以这里是网站naijaconnexion.com我问你的建议和事情这样做我克服了这个问题

如果我不够清楚,请问,如果你想要cpanel管理员访问我会发布它

我真的需要你的帮助

例如我在我的主页上有这个代码动作看起来没问题或需要优化以及如何

    $this->me = $this->getUser()->getGuardUser()->getPerson();
    $this->cities = Doctrine_Core::getTable('City')->findByDql("zipcode=''");
    $this->countries = Doctrine_Core::getTable('City')->findByDql("zipcode='10'");
    $this->contacts = $this->me->getContacts();
    $this->favorites = $this->me->getFavorites();
    $this->matches = $this->me->getMatches();
    $this->pager = new sfDoctrinePager('Conversation', sfConfig::get('app_home_conversations_per_page'));
    $this->pager->setQuery($this->me->getConversationsQuery());
    $this->pager->setPage($request->getParameter('page', 1));
    $this->pager->init();

没有HYDRATE_ARRAY 我能做到这一点

如果我使用HYDRATE_ARRAY 我可以做一些像$ this-> contacts [0] ['username'];

这样的东西

请帮助

1 个答案:

答案 0 :(得分:0)

问题在于学说......

尝试将所需的值作为数组获取并设置限制!

以下查询返回了多少个对象:

$this->cities = Doctrine_Core::getTable('City')->findByDql("zipcode=''");
$this->countries = Doctrine_Core::getTable('City')->findByDql("zipcode='10'");
$this->contacts = $this->me->getContacts();
$this->favorites = $this->me->getFavorites();
$this->matches = $this->me->getMatches();

?不要忘记它们是引用其他对象的对象!

是的,这将有效$this->contacts[0]['username'];

如果您使用doctrine查询加入表,您也可以访问相关实体 - 而无需执行其他查询。

$this->contacts = Doctrine_Core::getTable('Contact')
        ->createQuery('c')
        ->leftJoin('c.Users u')
        ->addWhere('...')
        ->execute(array(), Doctrine_Core::HYDRATE_ARRAY);


$this->contacts[0]['Users'][0]['username']