[prev in list] [next in list] [prev in thread] [next in thread]
List: taglib-devel
Subject: Possible memory leak || what I am doing wrong
From: joseph Dobson <dobson156 () gmail ! com>
Date: 2011-09-05 21:55:45
Message-ID: CAH9WD8_DvM22aGzULD7cCJndawpSEcWVMXLrf0O77aoAwSkwuQ () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
Hi, according to valgrind taglib always leave 32bytes on exit. I am using
taglib 1.7-3 that is provided from arch repository.
code is attached as is valgrind log.
I am compile with (have compile a non c++0x version and get the some result)
g++ id3.cpp -std=c++0x -ltag -I/usr/include/taglib
and it compiles and links just fine
and valgrinding with
valgrind --leak-check=full --show-reachable=yes ./a.out
I noted that the example that are packages with the tarball also produce the
same results. and looping over many file produces the same size.
Thanks.
[Attachment #5 (text/html)]
Hi, according to valgrind taglib always leave 32bytes on exit. I am using taglib \
1.7-3 that is provided from arch repository.<div><br></div><div>code is attached as \
is valgrind log.</div><div><br></div><div>I am compile with (have compile a non c++0x \
version and get the some result)</div> <div>g++ id3.cpp -std=c++0x -ltag \
-I/usr/include/taglib</div><div>and it compiles and links just \
fine</div><div><br></div><div><br></div><div>and valgrinding with</div><div>valgrind \
--leak-check=full --show-reachable=yes ./a.out</div> <div><br></div><div>I noted that \
the example that are packages with the tarball also produce the same results. and \
looping over many file produces the same size.</div><div><br></div><div>Thanks. \
</div>
--00151750e53ef24a3204ac38c55b--
["id3.cpp" (text/x-c++src)]
#include <tag.h>
#include <fileref.h>
#include <iostream>
#include <memory>
class sound_file
{
public:
sound_file(){}
sound_file( std::string _path, std::string _title, std::string _artist,
std::string _album, unsigned _year) :
path(_path), title(_title), artist(_artist),
album(_album), year(_year)
{}
/*
sound_file(sound_file &&other)
{
swap(other);
}
*/
void swap(sound_file &other)
{
title.swap(other.title);
artist.swap(other.artist);
std::swap(year,other.year);
album.swap(other.album);
}
std::string path;
std::string title;
std::string artist;
std::string album;
unsigned year;
static sound_file from_id3(const std::string &path)
{
TagLib::FileRef file(path.c_str());
std::string title= file.tag()->title().to8Bit();//make this true for unicode
std::string artist= file.tag()->artist().to8Bit();//make this true for unicode
std::string album= file.tag()->album().to8Bit();//make this true for unicode
unsigned year= file.tag()->year();
return sound_file(path, std::move(title), std::move(artist),
std::move(album), year);
}
friend std::ostream &operator<<(std::ostream &os, const sound_file &sf)
{
os << "Name: " << sf.title << "\nArtist: " << sf.artist
<< "\nAlbum:" << sf.album << "\nYear: " << sf.year << '\n';
}
private:
};
int main()
{
sound_file sf=sound_file::from_id3("/home/dobson/Music/Lycia/Cold/01 - Frozen.mp3");
std::cout << sf;
}
["val.out" (application/octet-stream)]
_______________________________________________
taglib-devel mailing list
taglib-devel@kde.org
https://mail.kde.org/mailman/listinfo/taglib-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic