小编Map*_*Dot的帖子

为什么is_array()在PHP中泄漏内存?

根据我的Xdebug的输出,is_array()泄漏得到数据传递给它作为参数的内存量.如果我传递一个大型数组,它会泄漏大量内存,以便检查它是否是一个数组.

这有解决方法吗?

   17.4313   21858520   +70004                   -> is_array() [...]/app/app_model.php:526
Run Code Online (Sandbox Code Playgroud)

这是导致泄漏的代码片段:

        $ret = $this->behaviors[$b[$i]]->afterFind($this, $results, true);
        if (is_array($ret)) {
            $results = $ret;
        }
Run Code Online (Sandbox Code Playgroud)

我在Linux上运行它(Ubuntu 9.04)

PHP:5.3.2

xdebug:2.0.5

uname -a给了我这个:

Linux的LINUX8 2.6.28-19服务器#64 Ubuntu的SMP周三08月18日21时57分33秒UTC 2010 i686的GNU/Linux的

php

8
推荐指数
1
解决办法
578
查看次数

标签 统计

php ×1