您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

在PHP中获取对象在内存中的大小?

2024/4/21 6:45:22发布11次查看
可以在为创建的类分配内存之前和之后调用 memory_get_usage() 函数。
class mybigclass { var $allocatedsize; var $allmyotherstuff;}function allocatemybigclass() { $before = memory_get_usage(); $ret = new mybigclass; $after = memory_get_usage(); $ret->allocatedsize = ($after - $before); return $ret;}
输出将是对象相对于环境设置的内存。
以上就是在php中获取对象在内存中的大小?的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product