Besides impacting GraphicsMagick (I am the GraphicsMagick developer), this bug impacts ImageMagick as well, and to a far greater degree. The leak is multiplied by the number of characters which are rendered.
Google AI claims that leaks in FT_Glyph_To_Bitmap() are virtually impossible and that they are almost always due to user code issues with glyph memory management. This might cause someone to think that this bug report is insignificant due to a likely usage error. However, I spent much of a day investigating the issue and there is nothing wrong with how the function is used. A sample ImageMagick command to expose the problem is: magick -size 70x50 xc:white -draw 'text 10,30 "HH"' null: and the quantity of leakage is determined by how many "H" characters are included in the string. If this is impacting GUI applications, then this could cause quite a lot of memory to be lost in the system. This is what I see happening with ImageMagick: % valgrind --tool=memcheck --leak-check=full --error-exitcode=2 --track- origins=yes --num-callers=12 --quiet magick -size 70x50 xc:white -draw 'text 10,30 "HH"' null: ==755795== 128 bytes in 2 blocks are definitely lost in loss record 13 of 24 ==755795== at 0x4850858: malloc (vg_replace_malloc.c:447) ==755795== by 0x59A1657: ??? (in /usr/lib/x86_64-linux-gnu/libfreetype.so.6.20.5) ==755795== by 0x59A59F4: ??? (in /usr/lib/x86_64-linux-gnu/libfreetype.so.6.20.5) ==755795== by 0x5A0F5FB: ??? (in /usr/lib/x86_64-linux-gnu/libfreetype.so.6.20.5) ==755795== by 0x59A442A: ??? (in /usr/lib/x86_64-linux-gnu/libfreetype.so.6.20.5) ==755795== by 0x59B1009: FT_Glyph_To_Bitmap (in /usr/lib/x86_64-linux-gnu/libfreetype.so.6.20.5) ==755795== by 0x48F5F97: RenderFreetype (in /usr/local/lib/libMagickCore-7.Q16HDRI.so.10.0.3) ==755795== by 0x48F68B7: RenderType (in /usr/local/lib/libMagickCore-7.Q16HDRI.so.10.0.3) ==755795== by 0x48F6DC6: GetTypeMetrics (in /usr/local/lib/libMagickCore-7.Q16HDRI.so.10.0.3) ==755795== by 0x4984886: RenderMVGContent (in /usr/local/lib/libMagickCore-7.Q16HDRI.so.10.0.3) ==755795== by 0x49885F2: DrawImage (in /usr/local/lib/libMagickCore-7.Q16HDRI.so.10.0.3) ==755795== by 0x4E9A25F: CLISimpleOperatorImage.isra.0 (in /usr/local/lib/libMagickWand-7.Q16HDRI.so.10.0.3) ==755795== ==755795== 128 bytes in 2 blocks are definitely lost in loss record 14 of 24 ==755795== at 0x4850858: malloc (vg_replace_malloc.c:447) ==755795== by 0x59A1657: ??? (in /usr/lib/x86_64-linux-gnu/libfreetype.so.6.20.5) ==755795== by 0x59A59F4: ??? (in /usr/lib/x86_64-linux-gnu/libfreetype.so.6.20.5) ==755795== by 0x5A0F5FB: ??? (in /usr/lib/x86_64-linux-gnu/libfreetype.so.6.20.5) ==755795== by 0x59A442A: ??? (in /usr/lib/x86_64-linux-gnu/libfreetype.so.6.20.5) ==755795== by 0x59B1009: FT_Glyph_To_Bitmap (in /usr/lib/x86_64-linux-gnu/libfreetype.so.6.20.5) ==755795== by 0x48F5F97: RenderFreetype (in /usr/local/lib/libMagickCore-7.Q16HDRI.so.10.0.3) ==755795== by 0x48F68B7: RenderType (in /usr/local/lib/libMagickCore-7.Q16HDRI.so.10.0.3) ==755795== by 0x48F6DC6: GetTypeMetrics (in /usr/local/lib/libMagickCore-7.Q16HDRI.so.10.0.3) ==755795== by 0x48F71BB: AnnotateImage (in /usr/local/lib/libMagickCore-7.Q16HDRI.so.10.0.3) ==755795== by 0x497F2AC: DrawPrimitive (in /usr/local/lib/libMagickCore-7.Q16HDRI.so.10.0.3) ==755795== by 0x498257B: RenderMVGContent (in /usr/local/lib/libMagickCore-7.Q16HDRI.so.10.0.3) ==755795== ==755795== 128 bytes in 2 blocks are definitely lost in loss record 15 of 24 ==755795== at 0x4850858: malloc (vg_replace_malloc.c:447) ==755795== by 0x59A1657: ??? (in /usr/lib/x86_64-linux-gnu/libfreetype.so.6.20.5) ==755795== by 0x59A59F4: ??? (in /usr/lib/x86_64-linux-gnu/libfreetype.so.6.20.5) ==755795== by 0x5A0F5FB: ??? (in /usr/lib/x86_64-linux-gnu/libfreetype.so.6.20.5) ==755795== by 0x59A442A: ??? (in /usr/lib/x86_64-linux-gnu/libfreetype.so.6.20.5) ==755795== by 0x59B1009: FT_Glyph_To_Bitmap (in /usr/lib/x86_64-linux-gnu/libfreetype.so.6.20.5) ==755795== by 0x48F5F97: RenderFreetype (in /usr/local/lib/libMagickCore-7.Q16HDRI.so.10.0.3) ==755795== by 0x48F68B7: RenderType (in /usr/local/lib/libMagickCore-7.Q16HDRI.so.10.0.3) ==755795== by 0x48F76EC: AnnotateImage (in /usr/local/lib/libMagickCore-7.Q16HDRI.so.10.0.3) ==755795== by 0x497F2AC: DrawPrimitive (in /usr/local/lib/libMagickCore-7.Q16HDRI.so.10.0.3) ==755795== by 0x498257B: RenderMVGContent (in /usr/local/lib/libMagickCore-7.Q16HDRI.so.10.0.3) ==755795== by 0x49885F2: DrawImage (in /usr/local/lib/libMagickCore-7.Q16HDRI.so.10.0.3) ==755795== -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/2166358 Title: Memory leak in libfreetype6 2.14.2 To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/freetype/+bug/2166358/+subscriptions -- ubuntu-bugs mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
