Memory leaks

Festus Hagen festushagenlists at yahoo.com
Wed Jul 24 15:43:04 UTC 2013


Hi all,


WinXPsp3
Qt5.1.0, Qt Creator 2.7.2
MSVC 2010 Ultimate
Both master and taglib2 

Thanks to TsudaKageyu's Debug handler, I finally figured out one of my biggest hurdles with C++ ... Sub Classing!
Many thanks to ya TsudaKageyu.

With my newly learned skills I have finally been able to write a functioning C++ GUI App with the help of Qt Creator ... Gotta love Qt Creator!

This newly created app is a id3v2tag frame viewer ...
A Directory tree view allows selection of a directory, a list of mp3 files is created, select a file and a list of the id3v2tag frames is created. Simple as it is, it was a challenge at first.

However I noticed it getting slower and slower as I browsed files ... Opps, Memory leak!
So I combed my code hard and couldn't find any thing, So I created MSVC project files for Taglib and my App, built them both with MSVC 2010, Followed the Microsoft topic:
Finding Memory Leaks Using the CRT Library http://msdn.microsoft.com/en-us/library/vstudio/x98tx3cf(v=vs.100).aspx. and found no leaks in my code, yet I knew there was!

So, I finally added the CRTDBG code to all of TagLib's .cpp files and these are my findings.

A plain simple main(...) simply doing:
  const char *file = "taglib/tests/data/id3v22-tda.mp3";
  TagLib::MPEG::File f(file);

Leaks the following ...
(My line numbers minus 7 CRTDBG lines equals Taglib2 line numbers)

mpegheader, 4 blocks totaling 104 bytes
    64 - 7 = 57
    87 - 7 = 80
ttbytevector, 24 blocks totaling 432 bytes
    258 - 7 = 251
    279 - 7 = 272
    353 - 7 = 346
    378 - 7 = 371
tstring, 306 blocks totaling 7344 bytes
    162 - 7 = 155
    195 - 7 = 188
    237 - 7 = 230
id3v2framefactory, 1 block totaling 8 bytes.

Obviously I ain't no guru so I am unsure if this is something of my doing, misunderstanding, or if this truly is a TagLib issue.

So, I thought I would put this out and let those that know, know!

I can provide the CrtDbg dump, it's 335 lines similarto the following:
    mpeg\mpegheader.cpp(64) : {54720} normal block at 0x00FCEEF0, 44 bytes long.


-Enjoy
fh : )_~



More information about the taglib-devel mailing list