PHP anonymous function 会被创建为 Closure
对象实例,默认情况下,会把所在对象的 $this
保持在 Closure
对象实例中。
如果$this
没有被使用,而 Closure
的生命周期比 $this
更长,造成了 $this
对象无法被回收。如果关联的实例过多,造成内存占用变高,内存关联开销变大,速度变慢。
PHP anonymous function 会被创建为 Closure
对象实例,默认情况下,会把所在对象的 $this
保持在 Closure
对象实例中。
如果$this
没有被使用,而 Closure
的生命周期比 $this
更长,造成了 $this
对象无法被回收。如果关联的实例过多,造成内存占用变高,内存关联开销变大,速度变慢。
本文标题:PHP anonymous function 设置为 stati
本文链接:https://www.haomeiwen.com/subject/epiaxrtx.html
网友评论