I found memory leak with QTextCodec::codecForName on Qt4.6, WindowsXP, VS2008.
For testing, I wrote a simple application.
int main(int argc, char *argv[])
{
QObject::connect(&hello,
SIGNAL(clicked
()),
&app,
SLOT(quit
()));
hello.show();
return app.exec();
}
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("EUC-KR"));
QPushButton hello("한글 테스트");
QObject::connect(&hello, SIGNAL(clicked()), &app, SLOT(quit()));
hello.show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
This code make some memory leak.
If I commented out line4, there is no memory leak. (However, my application needs the codec. )
//QTextCodec::setCodecForCStrings(QTextCodec::codecF orName("EUC-KR"));
In the official Qt documents, they mention that QApplication will de-allocate the QTextCodec's memory.
But, in my opinion, It doesn't work.
How can I get rid of this leak? or Is there something that I missed?
Bookmarks