From c7dba4a8cc561fb2a981f0becc4a6dd39a9b06d8 Mon Sep 17 00:00:00 2001 From: tsnorri Date: Thu, 31 May 2018 16:36:44 +0300 Subject: [PATCH] Free the image resource when the owner is deallocated --- Adapter/GD.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Adapter/GD.php b/Adapter/GD.php index 21bc00c..823a3f4 100644 --- a/Adapter/GD.php +++ b/Adapter/GD.php @@ -40,6 +40,12 @@ public function __construct() throw new \RuntimeException('You need to install GD PHP Extension to use this library'); } } + + public function __destruct() + { + if (null !== $this->resource) + imagedestroy($this->resource); + } /** * {@inheritdoc}