Skip to content

Commit 500c683

Browse files
authored
Optimize memory management in MediaTrait by replacing imagedestroy with unset for createdImage (#472)
1 parent 5e190f4 commit 500c683

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
44

55
This projects adheres to [Semantic Versioning](https://semver.org/) and [Keep a CHANGELOG](https://keepachangelog.com/).
66

7+
## [11.0.1]
8+
9+
### Fixed
10+
11+
- Memory leak in `MediaTrait` helper.
12+
713
## [11.0.0]
814

915
### Removed
@@ -1048,7 +1054,7 @@ Init setup
10481054
- Gutenberg Blocks Registration.
10491055
- Assets Manifest data.
10501056

1051-
[12.0.0]: https://github.com/infinum/eightshift-libs/compare/10.12.1...11.0.0
1057+
[11.0.1]: https://github.com/infinum/eightshift-libs/compare/11.0.0...11.0.1
10521058
[11.0.0]: https://github.com/infinum/eightshift-libs/compare/10.12.1...11.0.0
10531059
[10.12.1]: https://github.com/infinum/eightshift-libs/compare/10.12.0...10.12.1
10541060
[10.12.0]: https://github.com/infinum/eightshift-libs/compare/10.11.2...10.12.0

src/Helpers/MediaTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ public static function convertMediaToWebPByPath(string $filePath, int $quality =
161161
$newImage = \imagewebp($createdImage, $filePathNew, $quality);
162162

163163
// Free up memory.
164-
\imagedestroy($createdImage);
164+
unset($createdImage);
165165

166166
if (!$newImage) {
167167
throw new Exception(\esc_html__('Failed to create image due to unknown error', 'eightshift-libs'));

0 commit comments

Comments
 (0)