TagLib 1.7 Memory leak when saving Xiph comments in a FLAC file

David Troendle david at troendle.org
Mon May 9 18:00:50 CEST 2011


I am a newbie encountering a memory leak when saving comments in a FLAC
file.

 

I have distilled the problem down to the following code snippet:

 

      TagLib::FLAC::File FLACFile(<any FLAC file name>);

      TagLib::Ogg::XiphComment *FLACTags = FLACFile.xiphComment();

      FLACTags->addField("ARTIST", "New Value");

      FLACFile.save();

 

NOTE:  If the "FLACFile.save();" is omitted, only the one-time FrameFactory
and stringHandler leaks occurs. (No problem there.)

 

Environment is Windows 7 Ultimate 64, Visual Studio 2008, TagLib 1.7 (static
build), wxWidgets 2.9.1, and VLD 1.9h leak detector
(http://sites.google.com/site/dmoulding/vld).

 

Hope I am reporting the properly.  Please excuse any newbie errors.

 

Here is the VLD trace.  (It includes the usual one-time FrameFactor and
stringHandler allocation leaks, which can be ignored.):

 

WARNING: Visual Leak Detector detected memory leaks!

---------- Block 1755 at 0x0444FA48: 4 bytes ----------

  Call Stack:

    d:\my music\tools\libraries\taglib-1.7\taglib\mpeg\id3v1\id3v1tag.cpp
(54): `dynamic initializer for
'TagLib::ID3v1::Tag::TagPrivate::stringHandler''

    f:\dd\vctools\crt_bld\self_x86\crt\src\crt0dat.c (903): _initterm

    f:\dd\vctools\crt_bld\self_x86\crt\src\crt0dat.c (307): _cinit

    f:\dd\vctools\crt_bld\self_x86\crt\src\crt0.c (249): __tmainCRTStartup

    f:\dd\vctools\crt_bld\self_x86\crt\src\crt0.c (182): WinMainCRTStartup

    0x750A3677 (File and line number not available): BaseThreadInitThunk

    0x774F9F02 (File and line number not available):
RtlInitializeExceptionChain

    0x774F9ED5 (File and line number not available):
RtlInitializeExceptionChain

  Data:

    98 B9 92 01                                                  ........
........

 

---------- Block 8177 at 0x044B7680: 8 bytes ----------

  Call Stack:

    d:\my
music\tools\libraries\taglib-1.7\taglib\mpeg\id3v2\id3v2framefactory.cpp
(264): TagLib::ID3v2::FrameFactory::FrameFactory

    d:\my
music\tools\libraries\taglib-1.7\taglib\mpeg\id3v2\id3v2framefactory.cpp
(77): TagLib::ID3v2::FrameFactory::instance

    d:\my music\tools\libraries\taglib-1.7\taglib\flac\flacfile.cpp (67):
TagLib::FLAC::File::FilePrivate::FilePrivate

    d:\my music\tools\libraries\taglib-1.7\taglib\flac\flacfile.cpp (109):
TagLib::FLAC::File::File

    <Irrelevant stack info deleted.>

  Data:

    00 00 00 00    00 CD CD CD                                   ........
........

 

---------- Block 8214 at 0x044B7890: 12 bytes ----------

  Call Stack:

    d:\my music\tools\libraries\taglib-1.7\taglib\flac\flacfile.cpp (411):
TagLib::FLAC::File::scan

    d:\my music\tools\libraries\taglib-1.7\taglib\flac\flacfile.cpp (289):
TagLib::FLAC::File::read

    d:\my music\tools\libraries\taglib-1.7\taglib\flac\flacfile.cpp (111):
TagLib::FLAC::File::File

    <Irrelevant stack info deleted.>

  Data:

    B4 B9 92 01    00 00 00 00    B0 94 4B 04                    ........
..K.....

 

---------- Block 8212 at 0x044B79A0: 28 bytes ----------

  Call Stack:

    d:\my music\tools\libraries\taglib-1.7\taglib\toolkit\tbytevector.cpp
(296): TagLib::ByteVector::ByteVector

    d:\my music\tools\libraries\taglib-1.7\taglib\toolkit\tfile.cpp (158):
TagLib::File::readBlock

    d:\my music\tools\libraries\taglib-1.7\taglib\flac\flacfile.cpp (380):
TagLib::FLAC::File::scan

    d:\my music\tools\libraries\taglib-1.7\taglib\flac\flacfile.cpp (289):
TagLib::FLAC::File::read

    d:\my music\tools\libraries\taglib-1.7\taglib\flac\flacfile.cpp (111):
TagLib::FLAC::File::File

    <Irrelevant stack info deleted.>

  Data:

    01 00 00 00    00 00 00 00    CD CD CD CD    68 93 4B 04     ........
....h.K.

    71 94 4B 04    71 94 4B 04    09 01 00 00                    q.K.q.K.
........

 

---------- Block 8176 at 0x044B7F88: 8 bytes ----------

  Call Stack:

    d:\my
music\tools\libraries\taglib-1.7\taglib\mpeg\id3v2\id3v2framefactory.cpp
(77): TagLib::ID3v2::FrameFactory::instance

    d:\my music\tools\libraries\taglib-1.7\taglib\flac\flacfile.cpp (67):
TagLib::FLAC::File::FilePrivate::FilePrivate

    d:\my music\tools\libraries\taglib-1.7\taglib\flac\flacfile.cpp (109):
TagLib::FLAC::File::File

    <Irrelevant stack info deleted.>

  Data:

    E4 B8 92 01    80 76 4B 04                                   .....vK.
........

 

---------- Block 8213 at 0x044B9368: 265 bytes ----------

  Call Stack:

    c:\program files (x86)\microsoft visual studio 9.0\vc\include\xmemory
(43): std::_Allocate<char>

    c:\program files (x86)\microsoft visual studio 9.0\vc\include\xmemory
(145): std::allocator<char>::allocate

    c:\program files (x86)\microsoft visual studio 9.0\vc\include\vector
(1115): std::vector<char,std::allocator<char> >::_Buy

    c:\program files (x86)\microsoft visual studio 9.0\vc\include\vector
(546): std::vector<char,std::allocator<char> >::_Construct_n

    c:\program files (x86)\microsoft visual studio 9.0\vc\include\vector
(490): std::vector<char,std::allocator<char>
>::vector<char,std::allocator<char> >

    d:\my music\tools\libraries\taglib-1.7\taglib\toolkit\tbytevector.cpp
(243): TagLib::ByteVector::ByteVectorPrivate::ByteVectorPrivate

    d:\my music\tools\libraries\taglib-1.7\taglib\toolkit\tbytevector.cpp
(296): TagLib::ByteVector::ByteVector

    d:\my music\tools\libraries\taglib-1.7\taglib\toolkit\tfile.cpp (158):
TagLib::File::readBlock

    d:\my music\tools\libraries\taglib-1.7\taglib\flac\flacfile.cpp (380):
TagLib::FLAC::File::scan

    d:\my music\tools\libraries\taglib-1.7\taglib\flac\flacfile.cpp (289):
TagLib::FLAC::File::read

    d:\my music\tools\libraries\taglib-1.7\taglib\flac\flacfile.cpp (111):
TagLib::FLAC::File::File

    <Irrelevant stack info deleted.>

  Data:

    20 00 00 00    72 65 66 65    72 65 6E 63    65 20 6C 69     ....refe
rence.li

    62 46 4C 41    43 20 31 2E    32 2E 31 20    32 30 30 37     bFLAC.1.
2.1.2007

    30 39 31 37    0C 00 00 00    0F 00 00 00    41 4C 42 55     0917....
....ALBU

    4D 3D 52 69    6E 67 20 52    69 6E 67 18    00 00 00 41     M=Ring.R
ing....A

    4C 42 55 4D    53 4F 52 54    4F 52 44 45    52 3D 52 69     LBUMSORT
ORDER=Ri

    6E 67 20 52    69 6E 67 0B    00 00 00 41    52 54 49 53     ng.Ring.
...ARTIS

    54 3D 41 42    42 41 0F 00    00 00 41 52    54 49 53 54     T=ABBA..
..ARTIST

    53 4F 52 54    3D 41 42 42    41 14 00 00    00 41 52 54     SORT=ABB
A....ART

    49 53 54 53    4F 52 54 4F    52 44 45 52    3D 41 42 42     ISTSORTO
RDER=ABB

    41 09 00 00    00 42 41 4E    44 3D 41 42    42 41 09 00     A....BAN
D=ABBA..

    00 00 44 41    54 45 3D 31    39 37 33 0C    00 00 00 44     ..DATE=1
973....D

    49 53 43 4E    55 4D 42 45    52 3D 31 0A    00 00 00 47     ISCNUMBE
R=1....G

    45 4E 52 45    3D 52 6F 63    6B 0F 00 00    00 54 49 54     ENRE=Roc
k....TIT

    4C 45 3D 52    69 6E 67 20    52 69 6E 67    18 00 00 00     LE=Ring.
Ring....

    54 49 54 4C    45 53 4F 52    54 4F 52 44    45 52 3D 52     TITLESOR
TORDER=R

    69 6E 67 20    52 69 6E 67    0D 00 00 00    54 52 41 43     ing.Ring
....TRAC

    4B 4E 55 4D    42 45 52 3D    31                             KNUMBER=
1.......

 

---------- Block 8215 at 0x044B94B0: 12 bytes ----------

  Call Stack:

    d:\my
music\tools\libraries\taglib-1.7\taglib\flac\flacunknownmetadatablock.cpp
(48): TagLib::FLAC::UnknownMetadataBlock::UnknownMetadataBlock

    d:\my music\tools\libraries\taglib-1.7\taglib\flac\flacfile.cpp (411):
TagLib::FLAC::File::scan

    d:\my music\tools\libraries\taglib-1.7\taglib\flac\flacfile.cpp (289):
TagLib::FLAC::File::read

    d:\my music\tools\libraries\taglib-1.7\taglib\flac\flacfile.cpp (111):
TagLib::FLAC::File::File

    <Irrelevant stack info deleted.>

  Data:

    04 00 00 00    9C 9C 92 01    A0 79 4B 04                    ........
.yK.....

 

Visual Leak Detector detected 7 memory leaks.

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/taglib-devel/attachments/20110509/99c0be2c/attachment-0001.htm 


More information about the taglib-devel mailing list