duanchi19820419 2012-01-24 00:05
浏览 7

too long

if I have an entity repository and invoke the findAll() method, how would I be able to free the memory afterwards? I ran a small test using $entityManager->clear(), but it did not do the job. Thanks in advance for your help!

  • 写回答

1条回答 默认 最新

  • doulangxun7769 2012-01-24 00:22
    关注

    Do you need all records? Can you filter results, so less objects are created. The problem with php sometimes is, that it won't let you free the memory until the process has ended.

    You can try it with unset() if you need all records. But be aware the memory won't be free, I think the garbage collector of PHP has a problem with cycling references, doctrine I guess has such references to be powerful.

    A similar question to yours with an example: Why is PHP Doctine's free() not working?

    If it is a command line with mass iteration can you please try

    $this->_em->detach($row[0]);
    

    as described here: http://www.doctrine-project.org/blog/doctrine2-batch-processing

    评论

报告相同问题?

悬赏问题

  • ¥15 Oracle触发器记录修改前后的字段值
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器