douxin8749 2010-09-02 06:01
浏览 74
已采纳

Symfony单元测试和过多的内存泄漏?

We're currently having issues with memory leaks when using unit tests with Symfony 1.x to the magnitude of a decent number of tests eating 512MB of memory.

Currently we've tried:

  • Using a phpunit plugin
  • Using lime
  • Restricting the tests to a few sfPropelData loads + functional tests repeated a few times
  • Switching to PHP 5.3.3 to handle circular references
  • Inspecting memory usage xdebug which didn't give much insight

Soon we'll be trying:

  • Only the functional tests
  • Replacing sfPropelData instead loading plain SQL files
  • Only functional tests without any ORM calls
  • Valgrind?

I'm thinking maybe the static variables within symfony aren't getting cleaned up or the PDO layer is itself leaking memory. Of course, the last option is to figure out a way to run a suite of tests in its own process.

We're progressing through the areas it could be in and I don't expect anyone to actually help us work out the details but I'm just throwing this question out there to see if anyone has experienced this and where they found the leak to be or what they did to get around this.

Also, any input on other tools that can assist, like valgrind?

  • 写回答

1条回答 默认 最新

  • doutui839638 2010-09-02 14:22
    关注

    Only functional tests without any ORM calls

    That is one that I always try to prevent: Use Mock-Objects instead of accessing the database.

    What you can try is the new PHPUnit-Version that has process isolation of the tests (activated via additional command line parameter). That should help you. It is slower but helps with the memory problem

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘