Is imagedestroy () required when processing only one image?

I am using PHP to process an image using the GD extension. The structure of the code is quite complex, images are highlighted "deep" in the code, and there are many IFs that just help. The script only processes one image, and as soon as it writes it to a file, it exits.

I think I could use try ... catch instead, but I'm curious to know if it really needs to call imagedestroy (), or does the PHP garbage collector release it when the script ends?

+3


source to share


1 answer


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



+5


source







All Articles