Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-139600

Memory leak on macOS when adding application font from data

XMLWordPrintable

    • macOS
    • c02fe277a (dev), 3501d7616 (6.10), 55809001f (6.9), 427fd19b2 (tqtc/lts-6.8)

      When adding an application font from data (a QByteArray, or a file path leading to a compiled in resource), the leaks tool reports a memory leak:

      STACK OF 1 INSTANCE OF 'ROOT LEAK: <NSCTFontDescriptor>':
      8   dyld                                  0x198e9b154 start + 2476
      7   reproduction                          0x10008ea28 main + 80
      6   org.qt-project.QtGui                  0x102af5c78 QFontDatabase::addApplicationFont(QString const&) + 344  qfontdatabase.cpp:2308
      5   org.qt-project.QtGui                  0x102af4f54 QFontDatabasePrivate::addAppFont(QByteArray const&, QString const&) + 568  qfontdatabase.cpp:2211
      4   org.qt-project.QtGui                  0x102d9ec40 QCoreTextFontDatabase::addApplicationFont(QByteArray const&, QString const&, QFontDatabasePrivate::ApplicationFont*) + 608  qcoretextfontdatabase.mm:775
      3   com.apple.CoreText                    0x19b6d8c50 CTFontDescriptorCreateCopyWithAttributes + 80
      2   com.apple.CoreText                    0x19b6d8cd4 TCFRef<CTFontDescriptor*> TCFBase_NEW<CTFontDescriptor, CTFontDescriptor*, __CFDictionary const*>(CTFontDescriptor*&&, __CFDictionary const*&&) + 44
      1   com.apple.CoreFoundation              0x19928b198 _CFRuntimeCreateInstance + 852
      0   libsystem_malloc.dylib                0x19905fa68 _malloc_zone_malloc_instrumented_or_legacy + 148 
      ====
          45 (15.6K) ROOT LEAK: <NSCTFontDescriptor 0x12f894570> [112]
             42 (15.4K) _reserved3 --> <TBaseFont 0x12f8aa750> [592]
                20 (9.73K) <NSMutableCharacterSet 0x12f886590> [64]
                   1 (8.50K) <malloc in __CFCSetMakeBitmap 0x13005dc00> [8704]
                   18 (1.17K) <malloc in __CFCSetAddNonBMPPlanesInRange 0x12f843e00> [32]
                      17 (1.14K) <realloc in __CFCSetAddNonBMPPlanesInRange 0x12f881b70> [144]
                         1 (64 bytes) <NSMutableCharacterSet 0x12f882c60> [64]
                         1 (64 bytes) <NSMutableCharacterSet 0x12f882ca0> [64]
                         1 (64 bytes) <NSMutableCharacterSet 0x12f882f70> [64]
                         1 (64 bytes) <NSMutableCharacterSet 0x12f882fb0> [64]
                         1 (64 bytes) <NSMutableCharacterSet 0x12f8857e0> [64]
                         1 (64 bytes) <NSMutableCharacterSet 0x12f885820> [64]
                         1 (64 bytes) <NSMutableCharacterSet 0x12f894c40> [64]
                         1 (64 bytes) <NSMutableCharacterSet 0x12f894c80> [64]
                         1 (64 bytes) <NSMutableCharacterSet 0x12f899860> [64]
                         1 (64 bytes) <NSMutableCharacterSet 0x12f8998a0> [64]
                         1 (64 bytes) <NSMutableCharacterSet 0x12f89dc30> [64]
                         1 (64 bytes) <NSMutableCharacterSet 0x12f89dc70> [64]
                         1 (64 bytes) <NSMutableCharacterSet 0x12f8a5d70> [64]
                         1 (64 bytes) <NSMutableCharacterSet 0x12f8a96c0> [64]
                         1 (64 bytes) <NSMutableCharacterSet 0x12f8a9970> [64]
                         1 (64 bytes) <NSMutableCharacterSet 0x12f8a9bf0> [64]
                9 (3.56K) <NSMutableDictionary 0x12f8a94c0> [48]
                   8 (3.52K) <NSMutableDictionary (Storage) 0x12f897a70> [128]
                      2 (3.06K) <NSMutableArray 0x12f821a20> [64]
                         1 (3.00K) <NSMutableArray (Storage) 0x130077c00> [3072]
                      2 (176 bytes) <NSMutableDictionary 0x12f8a3fa0> [48]
                         1 (128 bytes) <NSMutableDictionary (Storage) 0x12f8988e0> [128]
                      3 (160 bytes) <NSMutableDictionary 0x12f8a46e0> [48]
                         2 (112 bytes) <NSMutableDictionary (Storage) 0x12f8a65a0> [64]
                            1 (48 bytes) <CFString 0x12f831c10> [48]
                9 (1.25K) <CGFont 0x12f8a9ab0> [144]
                   7 (1008 bytes) <calloc in xt_font_create 0x12f871700> [48]
                      6 (960 bytes) <TFPInMemoryFont 0x12f8aa570> [480]
                         2 (224 bytes) <CFArray 0x12f8a4080> [64]
                            1 (160 bytes) <malloc in _CFArrayReplaceValues 0x12f8aae80> [160]
                         1 (144 bytes) <malloc in TFPFont::GetFontInfo() const 0x12f8a9fa0> [144]
                         1 (64 bytes) <CFData 0x12f820150> [64]
                         1 (48 bytes) <TType1FontType2CIDCharStringHandler 0x12f8a55b0> [48]
                   1 (128 bytes) <calloc in get_font_info 0x12f8947b0> [128]
                2 (240 bytes) <NSURL 0x12f89f4a0> [144]
                   1 (96 bytes) _clients --> <CFString 0x12f89fe50> [96]
                1 (48 bytes) <CFString 0x12f8a3dd0> [48]
             2 (112 bytes) _attributes --> <NSMutableDictionary 0x12f8a9df0> [48]
                1 (64 bytes) <NSMutableDictionary (Storage) 0x12f888090> [64] 

      Reproduction attached.

        1. QTBUG-139600.zip
          9 kB
          Igor Khanin
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            esabraha Eskil Abrahamsen Blomfeldt
            igkh Igor Khanin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes