memory leak in id3v2framefactory.cpp
Daniel Schaack
daniel.schaack at education.lu
Wed Feb 2 18:51:33 CET 2011
Ofcourse, the leak disappears when the process is closed. It's just that when you're searching for memory leaks, false positives like this one don't help in the process :)
On Feb 2, 2011, at 4:47 PM, Scott Wheeler wrote:
> On Feb 1, 2011, at 12:29 AM, Daniel Schaack wrote:
>
>> Seems like the static variable:
>>
>> FrameFactory *FrameFactory::factory = 0;
>>
>> in id3v2framefactory.cpp
>>
>> doesnt' get deleted when my app closes. I'm using the static version
>> of
>> TagLib.
>
> No, it doesn't, but it doesn't matter. Honestly, when that code was
> written was largely before people starting using tools that reported
> these things and the only reason to care about that "leak" is to make
> it appear sanitary with said tools. A "leak" implies continual
> lossage, this is more like a "pool" that doesn't get emptied. ;-)
>
> Basically it's only allocated once, there's no destructor that needs
> to be called, and the net effect is that the memory is freed when the
> application exits, which is exactly what would happen if delete was
> called on it.
>
> That said, these days I usually write something like:
>
> FrameFactory *FrameFactory::instance()
> {
> static FrameFactory f;
> return &f;
> }
>
> -Scott
> _______________________________________________
> taglib-devel mailing list
> taglib-devel at kde.org
> https://mail.kde.org/mailman/listinfo/taglib-devel
More information about the taglib-devel
mailing list