【问题标题】:web server memory leak issueWeb服务器内存泄漏问题
【发布时间】:2012-06-27 18:14:36
【问题描述】:

我正在使用 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'];

之类的东西吗

请帮忙

【问题讨论】:

  • 还是一样的problem?为什么不回复其他答案并提供更多信息?
  • 只要问任何你想让我澄清的事情;)

标签: memory symfony1 webserver


【解决方案1】:

问题在于教义...

尝试以数组的形式获取所需的值并设置限制!

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

$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'];

如果您将表与学说查询连接起来,您也可以访问相关实体 - 无需执行额外的查询。

$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']

【讨论】:

  • 您好,经过一些测试,我再次注意到一个巨大的内存泄漏,我正在使用 Hydration Array 模式,但一段时间后服务器仍然黑屏,这是 url:chat.1000mabrouk.ma login:jasiri pass: 123456 你能自己测试一下,告诉我是什么问题吗?
猜你喜欢
  • 2012-04-23
  • 2016-06-09
  • 1970-01-01
  • 2010-09-22
  • 1970-01-01
  • 1970-01-01
  • 2011-07-21
  • 2016-07-28
相关资源
最近更新 更多