PHP:memory_get_peak_usage(false),何时应使用true? [英] PHP: memory_get_peak_usage(false), when should i use true?

查看:65
本文介绍了PHP:memory_get_peak_usage(false),何时应使用true?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

http://php.net/manual/de/function.memory-get-peak-usage.php 指出默认情况下,将返回emalloc()(用c ++编写的内存管理器)中的值.

http://php.net/manual/de/function.memory-get-peak-usage.php point out that by default the value from emalloc() (memory manager written in c++) will be returned.

在什么情况下我应该使用true作为参数?

In what cases should I use true as parameter?

推荐答案

据我的理解,答案是:

memory_get_peak_usage(true),当您需要找出应用程序的整体使用情况(包括各种间接费用等)时.当您想要了解应用程序的繁重程度时,这非常方便. true通常会将数字四舍五入为更大的数字,因为您不能只从RAM中分配729千字节,而是您的应用占用整个1024千字节.

memory_get_peak_usage(true) when you need to find out the WHOLE usage of your app, including all kinds of overheads and etc. It's handy when you want to find out how heavy your app is. true usually rounds up numbers to the bigger size, because you can't just allocate 729 KiloBytes from RAM, your app takes whole 1024 KiloBytes.

memory_get_peak_usage()在您想要找出哪种执行方式最轻量时非常方便,因此您可以将尽可能多的动作塞入已分配的1024 KB中.

memory_get_peak_usage() is handy when you want to find out which 'method' of execution is most lightweight, so you can cram as much actions as possible into the 1024 KiloBytes that are already allocated.

这篇关于PHP:memory_get_peak_usage(false),何时应使用true?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆