douza1373 2011-08-29 18:10
浏览 52
已采纳

memory_get_peak_usage()是返回整个php的内存还是仅返回当前执行的内存?

Let's say i call memory_get_peak_usage(true) and it returns 2.5MB.

  • Does it means that the whole php (all clients) is causing that peak?

  • Or does it means that if I have 100 clients acessing the same time, the peak could be 250MB?

  • 写回答

1条回答 默认 最新

  • douzhanshen0657 2011-08-29 18:12
    关注

    It returns the peak usage for the current request only.

    From the doc:

    Returns the peak of memory, in bytes, that's been allocated to your PHP script.


    To remove any ambiguities from the docs:

    memory_get_peak_usage() calls the internal zend_memory_peak_usage() function, which returns AG(mm_heap)->peak.

    AG(mm_heap)->peak is reset to 0 in zend_mm_shutdown(), which is called in php_request_shutdown() at the end of each request.

    So it's the peak memory usage for the current request only.

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

报告相同问题?

悬赏问题

  • ¥15 多址通信方式的抗噪声性能和系统容量对比
  • ¥15 winform的chart曲线生成时有凸起
  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 海浪数据 南海地区海况数据,波浪数据
  • ¥20 软件测试决策法疑问求解答