Is imagedestroy() required when you only process a single image?

徘徊边缘 提交于 2021-02-07 14:21:28

问题


I'm using PHP to process some image using GD extension. The code structure is rather complicated, images are allocated "deep" in the code and there are many IF's that simply bail-out. The script only processes a single image, and once it writes it to the file it exits.

I guess I could use try...catch instead, but I'm interested to know whether it is really needed to call imagedestroy() or PHP's garbage collector would free it when script ends?


回答1:


No, you don't need to call this function, but it's a good practice because images can be large and if you are in a crowded environment every kilobyte counts.



来源:https://stackoverflow.com/questions/9623260/is-imagedestroy-required-when-you-only-process-a-single-image

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!