Page MenuHomePhabricator

file_61711.txt

Authored By
bzimport
Nov 22 2014, 2:58 AM
Size
1 KB
Referenced Files
None
Subscribers
None

file_61711.txt

commit 692e4f9b68d596436f97db190df7bbcd9e361dda
Author: Brian Wolff <bawolff+wn@gmail.com>
Date: Sat Jun 21 17:29:38 2014 -0300
Add options to image magick to reduce memory usage.
Change-Id: I92d773a4f9bc8875527ed4ef1319dafddae6ff51
diff --git a/includes/media/Bitmap.php b/includes/media/Bitmap.php
index 44be178..253cddf 100644
--- a/includes/media/Bitmap.php
+++ b/includes/media/Bitmap.php
@@ -314,7 +314,7 @@ class BitmapHandler extends ImageHandler {
protected function transformImageMagick( $image, $params ) {
# use ImageMagick
global $wgSharpenReductionThreshold, $wgSharpenParameter, $wgMaxAnimatedGifArea,
- $wgImageMagickTempDir, $wgImageMagickConvertCommand;
+ $wgImageMagickTempDir, $wgImageMagickConvertCommand, $wgMaxShellMemory;
$quality = array();
$sharpen = array();
@@ -389,6 +389,15 @@ class BitmapHandler extends ImageHandler {
$animation_post,
array( $this->escapeMagickOutput( $params['dstPath'] ) ) ) );
+ // Setting some memory limit image magick memory limit variables seems to help
+ // prevent im from going over its memory limit. The affect seems particularly
+ // noticable with animated gif images when using cgroups. These values were
+ // chosen by trial and error on my local computer. See also:
+ // http://www.imagemagick.org/script/command-line-options.php#limit
+ $fiftyMB = 50 * 1024 * 1024;
+ $env['MAGICK_MAP_LIMIT'] = $fiftyMB;
+ $env['MAGICK_AREA_LIMIT'] = $env['MAGICK_MEMORY_LIMIT'] = $wgMaxShellMemory * 1024 - $fiftyMB;

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
12494
Default Alt Text
file_61711.txt (1 KB)

Event Timeline