Rendering a single character eat up all memories

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
zxytim
Posts: 3
Joined: 2014-08-25T20:41:28-07:00
Authentication code: 6789

Rendering a single character eat up all memories

Post by zxytim »

While I am rendering text using:
convert -pointsize 100 -font ./kaiti_GB2312.ttf label:O O.png
convert eat up all my free memory (about 4G). However, if I use smaller font size:
convert -pointsize 50 -font ./kaiti_GB2312.ttf label:O O.png
it works nicely. And more interesting, if I render another character other than 'O', like 'P', using 100 point size,
it also works like a charm:
convert -pointsize 100 -font ./kaiti_GB2312.ttf label:P P.png

I've tried other various fonts (around 1000 kinds, rendering [a-zA-Z0-9]) using the same setting that would fail
on kaiti_GB2312, they all worked smoothly.
I tested this font in LibreOffice, it also worked.

I hypothesize that the problem lies in the incompatibility between imagemagick and this fonts.

The font is uploaded here:
http://www.speedyshare.com/YXRWj/kaiti-GB2312.ttf

Best.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Rendering a single character eat up all memories

Post by magick »

Your command worked for us without any problems. We're using the ImageMagick 6.8.9-7 with Freetype 2.5.0.
zxytim
Posts: 3
Joined: 2014-08-25T20:41:28-07:00
Authentication code: 6789

Re: Rendering a single character eat up all memories

Post by zxytim »

I am using ImageMagick 6.8.9.7 with freetype 2.5.3 (newer that yours) on a arch box.
I did some further experiment on this issue, ends up with following findings:
1. The condition it fails seems like: "-pointsize <n>" where n > 50
2. It will create a fast growing temporary file named like '/tmp/magick-<magic-number>'. As I mount /tmp as tmpfs, this might be the cause of my memory exhaustiveness.
zxytim
Posts: 3
Joined: 2014-08-25T20:41:28-07:00
Authentication code: 6789

Re: Rendering a single character eat up all memories

Post by zxytim »

I still encounter the same problem after upgrading freetype to 2.5.3-2.
The problem shows up again when rendering a Chinese character using a different font.
This one works:
convert -pointsize 50 -font ./STXINGKA.TTF label:先 /tmp/xian.png
But this one fails.
convert -pointsize 51 -font ./STXINGKA.TTF label:先 /tmp/xian.png

Furthermore, this problem can also be reproduced on a Debian(sid) box with ImageMagick 6.8.9-6 and freetype 2.4.9-1.1.

Aforementioned font is here: http://speedy.sh/KbFMh/STXINGKA.TTF

I will really appreciate if the cause could be identified. Thank all ImageMagick staff.
Post Reply