FrameFactory leaking?

Scott Wheeler wheeler at
Wed Mar 5 16:44:48 CET 2008

Daniel Önnerby wrote:
> Hi!
> I just installed Visual Leak Detector in my project and it seem to think 
> that the TagLib::ID3v2::FrameFactory::instance() is leaking memory.
> I followed it to the FrameFactory::factory pointer and I can not find 
> where it's deleted.
> Am I responsible for deleting the pointer returned from the instance() 
> or is taglib doing this by itself?

It leaks, but more or less by design, being a singleton.  It could
easily enough be switched to a static value rather than a static
pointer, but it doesn't seem really important.

There are a couple other places in TagLib where the same happens.  In
cases where it's kind of constant leak (rather than one that happens,
say, every time you do a given operation) and there's no important stuff
happening in the destructor, it doesn't really matter.  In this case the
12 bytes are going to be allocated as soon as its used and freed when
the program exits, which is exactly what would happen if it weren't leaking.


More information about the taglib-devel mailing list